Error:Execution failed for task ':app:mergeDebugResources' - java

I don't even know where to start or even how to ask.
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources FAILED
Error:Execution failed for task ':app:mergeDebugResources'.
java.lang.ArrayIndexOutOfBoundsException (no error message)
Information:BUILD FAILED
Information:Total time: 1.241 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
I've never updated Android Studio, and I saw some similar problems and non of the solutions they gave worked for me.
I tried to change the class path from
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
to
dependencies {
classpath 'com.android.tools.build:gradle:0.4.3'
}
I don't know where to go from there

Related

Execution failed for task ':app:transformClassesWithDexForDebug' error

I'm having this error above whenever i try to build an APK:
Error: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}
This is my gradle build file:
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
How i can solve this error, i've followed some solutions here and in some forums but nothing worked with me..
Thank you for any help!!
Gradle console:
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

Building Google Maps example project with Android Studio 2.2.2

I have just downloaded Android Studio 2.2.2 and I try to build example projects. Blank activity project builds, deploys and runs successfully on my phone.
Then I try to build Google Maps project. I obtained an API key, copied it into google_maps_api.xml and didn't change anything else. Then, if I press Build -> Build APK, it fails with the following messages in Gradle Console:
Executing tasks: [:app:assembleDebug]
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:prepareComAndroidSupportAnimatedVectorDrawable2500Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72500Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72400Library UP-TO-DATE
:app:prepareComAndroidSupportPaletteV72400Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCompat2500Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUi2500Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUtils2500Library UP-TO-DATE
:app:prepareComAndroidSupportSupportFragment2500Library UP-TO-DATE
:app:prepareComAndroidSupportSupportMediaCompat2500Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42500Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2500Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAdsLite980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuth980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuthBase980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAwareness980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCastFramework980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesClearcut980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGass980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIid980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesInstantapps980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlaces980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTagmanager980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTagmanagerApi980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTasks980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesVision980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalytics980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuth980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuthCommon980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuthModule980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCommon980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseConfig980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCrash980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseDatabase980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseDatabaseConnection980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseIid980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseMessaging980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseStorage980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseStorageCommon980Library 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: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: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: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.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 53.036 secs
First I noticed "Incremental java compilation is an incubating feature" message. Maybe incremental compilation is the reason of the failure? If so, how can I disable it? I didn't find anything about it in build.gradle and other gradle-related files.
And if incremental build is not the reason, then what is it and how to fix it? This:
Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
looks like a gradle internal error. Am I right? Here is my build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
You must enable multidex for your project as total number of methods in your build exceeds 65536. See Configure Apps with Over 64K Methods

Error:Execution failed for task ':app:preDexDebug' when importing a jar

I added this jar file in my android studio project but when I tried to compile the project I am getting the following error.
Error:Execution failed for task ':app:preDexDebug'>
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
'C:\Program Files\Java\jdk1.8.0_60\bin\java.exe'' finished with
non-zero exit value 1
To import this jar I just Right Clicked on app -> New Module -> Import Jar Package.
And added this module to the dependency using File -> Project Structure -> Select the Module -> click on + and select Module Dependency
Here is my dependency in gradle:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':com.cevious.tally.jdbc') }
Output:
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets 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:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
at com.android.dx.command.dexer.Main.processClass(Main.java:752)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:718)
at com.android.dx.command.dexer.Main.access$1200(Main.java:85)
at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1645)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:672)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:574)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.parseClass(Main.java:764)
at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684)
at com.android.dx.command.dexer.Main.processClass(Main.java:749)
... 12 more
1 error; aborting
Error:Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_60\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 1.256 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
My JDK version is 1.8 and my Compile SDK version is 15. I dont think this is caused by JDK because this works fine on Netbeans with the same JDK version.
This Jar file contains some JDBC code. I doubt that this may be the problem.
Please help me to compile this jar in my project.

Android Studio Gradle doesn't build my app when using Comparator class?

This compiles and builds fine:
Collections.sort(array, null);
This one doesn't:
Collections.sort(array, new Comparator<ChatText>() {
#Override
public int compare(ChatText o1, ChatText o2) {
return (int) (o1.timestamp - o2.timestamp);
}
});
That's what I get:
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72310Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2310Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72220Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72310Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42310Library UP-TO-DATE
:app:prepareComCrashlyticsSdkAndroidAnswers132Library UP-TO-DATE
:app:prepareComCrashlyticsSdkAndroidBeta113Library UP-TO-DATE
:app:prepareComCrashlyticsSdkAndroidCrashlytics252Library UP-TO-DATE
:app:prepareComCrashlyticsSdkAndroidCrashlyticsCore235Library UP-TO-DATE
:app:prepareComFacebookAndroidFacebookAndroidSdk470Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesVision810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable810Library UP-TO-DATE
:app:prepareIoFabricSdkAndroidFabric136Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:fabricGenerateResourcesDebug
:app:processDebugResources
:app:generateDebugSources
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:preDexDebug UP-TO-DATE
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502)
at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277)
at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 10.116 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
Tried cleaning the project few times, didn't help. A solution without the usage of Comparator class would help too.
Nothing to do with Comparator class. You have reached your dexing limit. This means you have reached the limit for references that can be invoked by the code within a single Dalvik Executable (Googles explanation). The solution is very easy. Take a look at this answer to see how to enable multidexing.

Gradle does not recognize changes in jar manifest

I am new to gradle and try out some basic examples from the command line.
The example tells me to put this into my build.gradle file to make the class my main jar class.
jar.manifest.attributes 'Main-Class': 'de.gradlebuch.HelloWorld'
After that, the build output should look like this:
PS C:\Users\user\Desktop\gradle test\HelloWorld> gradle build
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build UP-TO-DATE
Unfortunately, it isn't. I get:
PS C:\Users\user\Desktop\gradle test\HelloWorld> gradle build
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar UP-TO-DATE
:assemble UP-TO-DATE
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build UP-TO-DATE
The jar and assembler task are UP_TO_DATE and the attribute is not in the Manifest.MF file.
When I do
gradle clean
gradle build
everything is fine. But I tought Gradle would be capable of detecting these kind of changes without rebuilding everyting.
What can I do to get Gradle detect changes in my build.gradle file?

Categories

Resources