首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android第3级构建失败

Android第3级构建失败
EN

Stack Overflow用户
提问于 2017-11-09 11:23:39
回答 1查看 308关注 0票数 1

我在用Gradle 3编译我的项目时遇到了一些问题。当我更新我的项目以使用这个版本的Gradle时,gradle同步是可以的,但是只要我一按run按钮,它就会给我这样的结果:

代码语言:javascript
复制
Error:Execution failed for task 
':app:compileBetaGoogleWebkitDebuggableReleaseJavaWithJavac'.
> java.lang.NoClassDefFoundError: com/fyber/annotations/FyberSDK

对于较老的gradle (2.3.3),它的工作原理非常完美,但出于不可披露的专业原因,我需要更新这个项目。在这两个版本之间,一个看到FyberSDK,另一个没有看到,这两个版本之间有什么问题呢?

这是我的评分脚本

代码语言:javascript
复制
apply plugin: 'com.android.application'

def mVersionCode = 16;
def mVersionName = "1.16"

android {
signingConfigs {
    releaseSigning {
        keyAlias 'redacted'
        keyPassword 'redacted'
        storeFile file('redacted')
        storePassword 'redacted'
    }
}
compileSdkVersion 23
defaultConfig {
    applicationId "redacted"
    minSdkVersion 19
    targetSdkVersion 23
    versionCode mVersionCode
    versionName mVersionName
    resValue "string", "app_version_name", mVersionName
    resValue "string", "app_name", "redacted"
}
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.releaseSigning
    }
    debuggableRelease {
        debuggable true
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.releaseSigning
    }
}

flavorDimensions "server", "lib"

productFlavors {
    pubGoogle {
        dimension "server"
        minSdkVersion 19
        buildConfigField("boolean", "isGoogleBuild", "true")
    }
    betaGoogle {
        dimension "server"
        minSdkVersion 14
        resValue "string", "app_version_name", mVersionName + "beta"
        resValue "string", "app_name", "redacted Beta"
        buildConfigField("boolean", "isGoogleBuild", "true")
    }
    pubAmazon {
        dimension "server"
        minSdkVersion 19
        buildConfigField("boolean", "isGoogleBuild", "false")
    }
    betaAmazon {
        dimension "server"
        minSdkVersion 14
        resValue "string", "app_version_name", mVersionName + "beta"
        resValue "string", "app_name", "redacted Beta"
        buildConfigField("boolean", "isGoogleBuild", "false")
    }
    /*xwalk {
        dimension "lib"
    }*/
    webkit {
        dimension "lib"
    }
}
}

repositories {
mavenCentral()
maven {
    name "Fyber's maven repo"
    url "https://fyber.bintray.com/maven"
}
}

configurations {
provided
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'com.sponsorpay:sponsorpay-android-sdk:7.2.8'

compile 'com.fyber:fyber-sdk:8.17.0'
// Fyber Annotations
provided 'com.fyber:fyber-annotations:1.3.0'
annotationProcessor 'com.fyber:fyber-annotations-compiler:1.4.0'
// Fyber mediation services
// UnityAds Mediation
compile 'com.fyber.mediation:unityads:2.1.1-r1@aar'
// ChartBoost Mediation
compile 'com.fyber.mediation:chartboost:6.6.3-r2@aar'
// Vungle Mediation
compile 'com.fyber.mediation:vungle:5.3.0-r1@aar'

// Vungle third-party dependencies
compile 'com.google.dagger:dagger:2.7'
compile 'javax.inject:javax.inject:1'
compile 'de.greenrobot:eventbus:2.2.1'
compile 'io.reactivex:rxjava:1.2.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.squareup.okio:okio:1.11.0'
compile 'com.google.android.gms:play-services-basement:11.0.1'
compile 'com.google.android.gms:play-services-location:11.0.1'

// For AppsFlyer
compile 'com.appsflyer:af-android-sdk:4.6.0@aar'
compile 'com.google.android.gms:play-services-ads:11.0.1'
compile 'com.google.android.gms:play-services-gcm:11.0.1'
compile 'com.google.android.gms:play-services-auth:11.0.1'

compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
//xwalkCompile 'org.xwalk:xwalk_core_library:23.53.589.4'
}

apply plugin: 'com.google.gms.google-services'
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-12-01 08:12:47

我也遇到了这个问题,最终解决了这个问题。

您可能会使用这样的注释:

@FyberSDK

您所需要的就是找到这个注释,并用以下内容更改它的build.gradle文件:

代码语言:javascript
复制
apply plugin: 'com.android.library'

android {
// ...
// add this code to enable annotationProcessor
   javaCompileOptions {
        annotationProcessorOptions {
            includeCompileClasspath = true
        }
    }
}

dependencies {
// ...
// Fyber Annotations
compileOnly 'com.fyber:fyber-annotations:1.3.0'
annotationProcessor 'com.fyber:fyber-annotations-compiler:1.4.0'
// ...
}

试试这段代码,同步你的project.hope很好,对我来说也很好。如果你想了解更多细节,你可以在这里阅读我的博客:

https://segmentfault.com/a/1190000012245056

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47200597

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档