2017-05-25 140 views
-1

我在引用这个https://github.com/mopub/mopub-android-sdk/wiki/Getting-Started来将mopub集成到我的应用中。我在我的项目的build.gradle文件中添加mopub-sdk依赖项时出现错误“找不到方法编译参数”。请帮助我。 的build.gradle文件:Gradle Sync失败:找不到方法compile()参数

buildscript { 
    repositories { 

    jcenter() 
    maven { url "https://jitpack.io" } 
    } 

    dependencies { 
    classpath 'com.android.tools.build:gradle:2.2.3' 
    }} 
    allprojects { 


    repositories { 
    jcenter() 

} 
dependencies { 

    compile('com.mopub:mopub-sdk:[email protected]') { 
     transitive = true 
    } 
    // For banners 
    compile('com.mopub:mopub-sdk-banner:[email protected]') { 
     transitive = true 
    } 

    // For interstitials 
    compile('com.mopub:mopub-sdk-interstitial:[email protected]') { 
     transitive = true 
    } 
    // For rewarded videos. This will automatically also include 
     interstitials 
    compile('com.mopub:mopub-sdk-rewardedvideo:[email protected]') { 
     transitive = true 
    } 
    // For native static (images). 
    compile('com.mopub:mopub-sdk-native-static:[email protected]') { 
     transitive = true 
    } 

    // For native video. This will automatically also include native static 
    compile('com.mopub:mopub-sdk-native-video:[email protected]') 
    {transitive = true} 
    } 
    } 
    task clean(type: Delete) { 
    delete rootProject.buildDir 
    } 

实际误差: -

Error:(31, 0) Could not find method compile() for arguments [com.mopub:mopub-sdk:[email protected], bu[email protected]1c36532] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. 

回答

0

你需要把你的依赖在其他build.gradle。它们属于单个模块build.gradle文件。

此外,您正在导入com.mopub:mopub-sdk:[email protected],其中包含所有的广告格式依赖关系,您已在下面的Gradle文件中包含这些依赖关系。您只需要模块化文物com.mopub:mopub-sdk:[email protected]

相关问题