每当我尝试构建APK时,我都会遇到此错误:
错误:任务':app:transformClassesWithDexForDebug'执行失败。
com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:com.android.ide.common.process.ProcessException:执行时出错带有参数的主要类com.android.dx.command.Main的java进程{--dex --num-threads = 4 --multi-dex --main-dex-list C:\ Users \ admin \ Desktop \ FlagQuiz \ app \ build \ intermediates \ multi-dex \ debug \ maindexlist.txt --output C:\ Users \ admin \ Desktop \ FlagQuiz \ app \ build \ intermediates \ transforms \ dex \ debug \ folders \ 1000 \ 1f \ main C: \用户\管理员\桌面\ FlagQuiz \应用\构建\中间体\变换\ jarMerging \调试\罐\ 1 \ 1F \ combined.jar}
这是我的gradle构建文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.quiz"
multiDexEnabled true
minSdkVersion 15
targetSdkVersion 25
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_5
targetCompatibility JavaVersion.VERSION_1_5
}
}
dexOptions {
javaMaxHeapSize "2g"
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
'proguard-rules.pro'
lintOptions {
disable 'MissingTranslation'
// checkRleaeseBuilds false
abortOnError false
}
}
}
}
dependencies {
compile project(':BaseGameUtils')
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.2'
compile 'com.google.firebase:firebase-crash:11.0.2'
compile 'com.google.android.gms:play-services-auth:11.0.4'
compile 'com.android.support:multidex:1.0.1'
}
//apply plugin: 'com.google.gms.google-services' <-- I commented it according to some solutions but it's didn't solve the problem
我如何解决这个错误,我已经在这里和某些论坛中采用了一些解决方案,但没有任何对我有用..
感谢您的帮助!!
Gradle控制台:
Executing tasks: [:BaseGameUtils:assembleDebug, :app:assembleDebug]
Configuration on demand is an incubating feature.
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\admin\AppData\Local\Android\sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
The setTestClassesDir(File) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the setTestClassesDirs(FileCollection) method instead.
The getTestClassesDir() method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the getTestClassesDirs() method instead.
The ConfigurableReport.setDestination(Object) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the method ConfigurableReport.setDestination(File) instead.
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\admin\AppData\Local\Android\sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
:BaseGameUtils:preBuild UP-TO-DATE
:BaseGameUtils:preDebugBuild UP-TO-DATE
:BaseGameUtils:checkDebugManifest
:BaseGameUtils:preDebugAndroidTestBuild UP-TO-DATE
:BaseGameUtils:preDebugUnitTestBuild UP-TO-DATE
:BaseGameUtils:preReleaseBuild UP-TO-DATE
:BaseGameUtils:preReleaseUnitTestBuild UP-TO-DATE
:BaseGameUtils:prepareComAndroidSupportAnimatedVectorDrawable2540Library
:BaseGameUtils:prepareComAndroidSupportAppcompatV72540Library
:BaseGameUtils:prepareComAndroidSupportSupportCompat2540Library
:BaseGameUtils:prepareComAndroidSupportSupportCoreUi2540Library
:BaseGameUtils:prepareComAndroidSupportSupportCoreUtils2540Library
:BaseGameUtils:prepareComAndroidSupportSupportFragment2540Library
:BaseGameUtils:prepareComAndroidSupportSupportMediaCompat2540Library
:BaseGameUtils:prepareComAndroidSupportSupportV42540Library
:BaseGameUtils:prepareComAndroidSupportSupportVectorDrawable2540Library
:BaseGameUtils:prepareComGoogleAndroidGmsPlayServicesAuth1102Library
:BaseGameUtils:prepareComGoogleAndroidGmsPlayServicesAuthBase1102Library
:BaseGameUtils:prepareComGoogleAndroidGmsPlayServicesBase1102Library
:BaseGameUtils:prepareComGoogleAndroidGmsPlayServicesBasement1102Library
:BaseGameUtils:prepareComGoogleAndroidGmsPlayServicesDrive1026Library
:BaseGameUtils:prepareComGoogleAndroidGmsPlayServicesGames1026Library
:BaseGameUtils:prepareComGoogleAndroidGmsPlayServicesPlus1026Library
:BaseGameUtils:prepareComGoogleAndroidGmsPlayServicesTasks1102Library
:BaseGameUtils:prepareComGoogleFirebaseFirebaseAnalytics1102Library
:BaseGameUtils:prepareComGoogleFirebaseFirebaseAnalyticsImpl1102Library
:BaseGameUtils:prepareComGoogleFirebaseFirebaseCommon1102Library
:BaseGameUtils:prepareComGoogleFirebaseFirebaseCore1102Library
:BaseGameUtils:prepareComGoogleFirebaseFirebaseIid1102Library
:BaseGameUtils:prepareDebugDependencies
:BaseGameUtils:compileDebugAidl UP-TO-DATE
:BaseGameUtils:compileDebugNdk NO-SOURCE
:BaseGameUtils:compileLint UP-TO-DATE
:BaseGameUtils:copyDebugLint NO-SOURCE
:BaseGameUtils:compileDebugRenderscript UP-TO-DATE
:BaseGameUtils:generateDebugBuildConfig UP-TO-DATE
:BaseGameUtils:generateDebugResValues UP-TO-DATE
:BaseGameUtils:generateDebugResources UP-TO-DATE
:BaseGameUtils:mergeDebugResources UP-TO-DATE
:BaseGameUtils:processDebugManifest UP-TO-DATE
:BaseGameUtils:processDebugResources UP-TO-DATE
:BaseGameUtils:generateDebugSources UP-TO-DATE
:BaseGameUtils:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:BaseGameUtils:javaPreCompileDebug
:BaseGameUtils:compileDebugJavaWithJavac UP-TO-DATE
:BaseGameUtils:extractDebugAnnotations UP-TO-DATE
:BaseGameUtils:mergeDebugShaders UP-TO-DATE
:BaseGameUtils:compileDebugShaders UP-TO-DATE
:BaseGameUtils:generateDebugAssets UP-TO-DATE
:BaseGameUtils:mergeDebugAssets UP-TO-DATE
:BaseGameUtils:mergeDebugProguardFiles UP-TO-DATE
:BaseGameUtils:packageDebugRenderscript NO-SOURCE
:BaseGameUtils:packageDebugResources UP-TO-DATE
:BaseGameUtils:processDebugJavaRes NO-SOURCE
:BaseGameUtils:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:BaseGameUtils:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE
:BaseGameUtils:mergeDebugJniLibFolders UP-TO-DATE
:BaseGameUtils:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
:BaseGameUtils:transformNativeLibsWithSyncJniLibsForDebug UP-TO-DATE
:BaseGameUtils:bundleDebug UP-TO-DATE
:BaseGameUtils:compileDebugSources UP-TO-DATE
:BaseGameUtils:assembleDebug UP-TO-DATE
:BaseGameUtils:checkReleaseManifest
:BaseGameUtils:prepareReleaseDependencies
:BaseGameUtils:compileReleaseAidl UP-TO-DATE
:BaseGameUtils:compileReleaseNdk NO-SOURCE
:BaseGameUtils:copyReleaseLint NO-SOURCE
:BaseGameUtils:compileReleaseRenderscript UP-TO-DATE
:BaseGameUtils:generateReleaseBuildConfig UP-TO-DATE
:BaseGameUtils:generateReleaseResValues UP-TO-DATE
:BaseGameUtils:generateReleaseResources UP-TO-DATE
:BaseGameUtils:mergeReleaseResources UP-TO-DATE
:BaseGameUtils:processReleaseManifest UP-TO-DATE
:BaseGameUtils:processReleaseResources UP-TO-DATE
:BaseGameUtils:generateReleaseSources UP-TO-DATE
:BaseGameUtils:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:BaseGameUtils:javaPreCompileRelease
:BaseGameUtils:compileReleaseJavaWithJavac UP-TO-DATE
:BaseGameUtils:extractReleaseAnnotations UP-TO-DATE
:BaseGameUtils:mergeReleaseShaders UP-TO-DATE
:BaseGameUtils:compileReleaseShaders UP-TO-DATE
:BaseGameUtils:generateReleaseAssets UP-TO-DATE
:BaseGameUtils:mergeReleaseAssets UP-TO-DATE
:BaseGameUtils:mergeReleaseProguardFiles UP-TO-DATE
:BaseGameUtils:packageReleaseRenderscript NO-SOURCE
:BaseGameUtils:packageReleaseResources UP-TO-DATE
:BaseGameUtils:processReleaseJavaRes NO-SOURCE
:BaseGameUtils:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:BaseGameUtils:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
:BaseGameUtils:mergeReleaseJniLibFolders UP-TO-DATE
:BaseGameUtils:transformNativeLibsWithMergeJniLibsForRelease UP-TO-DATE
:BaseGameUtils:transformNativeLibsWithSyncJniLibsForRelease UP-TO-DATE
:BaseGameUtils:bundleRelease UP-TO-DATE
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2540Library
:app:prepareComAndroidSupportAppcompatV72540Library
:app:prepareComAndroidSupportMediarouterV72520Library
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library
:app:prepareComAndroidSupportPaletteV72520Library
:app:prepareComAndroidSupportSupportCompat2540Library
:app:prepareComAndroidSupportSupportCoreUi2540Library
:app:prepareComAndroidSupportSupportCoreUtils2540Library
:app:prepareComAndroidSupportSupportFragment2540Library
:app:prepareComAndroidSupportSupportMediaCompat2540Library
:app:prepareComAndroidSupportSupportV42540Library
:app:prepareComAndroidSupportSupportVectorDrawable2540Library
:app:prepareComGoogleAndroidGmsPlayServices1104Library
:app:prepareComGoogleAndroidGmsPlayServicesAds1104Library
:app:prepareComGoogleAndroidGmsPlayServicesAdsLite1104Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics1104Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl1104Library
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite1104Library
:app:prepareComGoogleAndroidGmsPlayServicesAuth1104Library
:app:prepareComGoogleAndroidGmsPlayServicesAuthApiPhone1104Library
:app:prepareComGoogleAndroidGmsPlayServicesAuthBase1104Library
:app:prepareComGoogleAndroidGmsPlayServicesAwareness1104Library
:app:prepareComGoogleAndroidGmsPlayServicesBase1104Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement1104Library
:app:prepareComGoogleAndroidGmsPlayServicesCast1104Library
:app:prepareComGoogleAndroidGmsPlayServicesCastFramework1104Library
:app:prepareComGoogleAndroidGmsPlayServicesClearcut1104Library
:app:prepareComGoogleAndroidGmsPlayServicesDrive1104Library
:app:prepareComGoogleAndroidGmsPlayServicesFitness1104Library
:app:prepareComGoogleAndroidGmsPlayServicesGames1104Library
:app:prepareComGoogleAndroidGmsPlayServicesGass1104Library
:app:prepareComGoogleAndroidGmsPlayServicesGcm1104Library
:app:prepareComGoogleAndroidGmsPlayServicesIdentity1104Library
:app:prepareComGoogleAndroidGmsPlayServicesIid1104Library
:app:prepareComGoogleAndroidGmsPlayServicesInstantapps1104Library
:app:prepareComGoogleAndroidGmsPlayServicesLocation1104Library
:app:prepareComGoogleAndroidGmsPlayServicesMaps1104Library
:app:prepareComGoogleAndroidGmsPlayServicesNearby1104Library
:app:prepareComGoogleAndroidGmsPlayServicesPanorama1104Library
:app:prepareComGoogleAndroidGmsPlayServicesPlaces1104Library
:app:prepareComGoogleAndroidGmsPlayServicesPlus1104Library
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet1104Library
:app:prepareComGoogleAndroidGmsPlayServicesTagmanager1104Library
:app:prepareComGoogleAndroidGmsPlayServicesTagmanagerApi1104Library
:app:prepareComGoogleAndroidGmsPlayServicesTagmanagerV4Impl1104Library
:app:prepareComGoogleAndroidGmsPlayServicesTasks1104Library
:app:prepareComGoogleAndroidGmsPlayServicesVision1104Library
:app:prepareComGoogleAndroidGmsPlayServicesVisionCommon1104Library
:app:prepareComGoogleAndroidGmsPlayServicesWallet1104Library
:app:prepareComGoogleAndroidGmsPlayServicesWearable1104Library
:app:prepareComGoogleFirebaseFirebaseAnalytics1104Library
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl1104Library
:app:prepareComGoogleFirebaseFirebaseAppindexing1104Library
:app:prepareComGoogleFirebaseFirebaseAuth1104Library
:app:prepareComGoogleFirebaseFirebaseCommon1104Library
:app:prepareComGoogleFirebaseFirebaseConfig1104Library
:app:prepareComGoogleFirebaseFirebaseCore1102Library
:app:prepareComGoogleFirebaseFirebaseCrash1104Library
:app:prepareComGoogleFirebaseFirebaseDatabase1104Library
:app:prepareComGoogleFirebaseFirebaseDatabaseConnection1104Library
:app:prepareComGoogleFirebaseFirebaseDynamicLinks1104Library
:app:prepareComGoogleFirebaseFirebaseIid1104Library
:app:prepareComGoogleFirebaseFirebaseMessaging1104Library
:app:prepareComGoogleFirebaseFirebaseStorage1104Library
:app:prepareComGoogleFirebaseFirebaseStorageCommon1104Library
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
: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:javaPreCompileDebug
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk NO-SOURCE
:app:compileDebugSources UP-TO-DATE
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:transformClassesWithJarMergingForDebug
:app:transformClassesWithMultidexlistForDebug
:app:transformClassesWithDexForDebug
Running dex as a separate process.
To run dex in process, the Gradle daemon needs a larger heap.
It currently has 1024 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to at least 2560 MB (based on the dexOptions.javaMaxHeapSize = 2g).
To do this set org.gradle.jvmargs=-Xmx2560M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
:app:transformClassesWithDexForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --num-threads=4 --multi-dex --main-dex-list C:\Users\admin\Desktop\FlagQuiz\app\build\intermediates\multi-dex\debug\maindexlist.txt --output C:\Users\admin\Desktop\FlagQuiz\app\build\intermediates\transforms\dex\debug\folders\1000\1f\main C:\Users\admin\Desktop\FlagQuiz\app\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar}
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 3s
154 actionable tasks: 102 executed, 52 up-to-date