当我想用我的应用制作一个apk时,我发现了一个错误(我把所有东西都放了,以防它可以帮助你解决我的问题......):
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2421Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72421Library UP-TO-DATE
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCompat2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUi2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUtils2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportFragment2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportMediaCompat2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2421Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds1020Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAdsLite1020Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase1020Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement1020Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesClearcut1020Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGass1020Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTasks1020Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAds1020Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalytics1020Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl1020Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCommon1020Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCore1020Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseIid1020Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
Parsing json file: C:\Users\Espremea\Documents\Longest game ever\app\google-services.json
:app:generateDebugResources
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:transformClassesWithJarMergingForDebug FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/ads/AdRequest$ErrorCode.class
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
问题只发生在我构建APK时,而不是在构建期间,也不是使用模拟器或手机直接运行。
这是我的build.gradle
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "course.examples.longestgameever"
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/GoogleAdMobAdsSdk-6.0.1.jar')
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.google.firebase:firebase-ads:10.2.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
我真的不知道该怎么做,也没有找到适合我的网上任何内容。谢谢你的帮助:)!