Issue
For a few days I have not been able to compile my project with the MacBook anymore while I am able to compile it with a Windows PC, despite not having changed anything. Until a few days ago I was able to compile without any problem but now I can no longer compile on MacBook even the previous releases this happens only on MacBook instead on Windows PC I can still compile without any problem.
Any ideas on what might have happened?
Compiling on MacBook I get that error, here full stacktrace:
AGPBI: {"kind":"error","text":"java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0","sources":[{"file":"/MyProject/app/build/intermediates/transforms/APMSPlugin/devGms/debug/57.jar"}],"tool":"D8"}
org.gradle.workers.WorkerExecutionException: There was a failure while executing work items
at org.gradle.workers.internal.DefaultWorkerExecutor.workerExecutionException(DefaultWorkerExecutor.java:270)
at org.gradle.workers.internal.DefaultWorkerExecutor.await(DefaultWorkerExecutor.java:252)
at com.android.build.gradle.internal.tasks.DexArchiveBuilderTaskDelegate.doProcess(DexArchiveBuilderTaskDelegate.kt:274)
at com.android.build.gradle.internal.tasks.DexArchiveBuilderTask.doTaskAction(DexArchiveBuilderTask.kt:275)
at com.android.build.gradle.internal.tasks.NewIncrementalTask$taskAction$$inlined$recordTaskAction$1.invoke(BaseTask.kt:66)
at com.android.build.gradle.internal.tasks.Blocks.recordSpan(Blocks.java:51)
at com.android.build.gradle.internal.tasks.NewIncrementalTask.taskAction(NewIncrementalTask.kt:41)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
at org.gradle.api.internal.project.taskfactory.IncrementalInputsTaskAction.doExecute(IncrementalInputsTaskAction.java:32)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
at org.gradle.api.internal.project.taskfactory.AbstractIncrementalTaskAction.execute(AbstractIncrementalTaskAction.java:25)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.run(ExecuteActionsTaskExecuter.java:506)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build.gradle.internal.dexing.DexWorkAction
at org.gradle.workers.internal.DefaultWorkerExecutor$WorkItemExecution.waitForCompletion(DefaultWorkerExecutor.java:342)
at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForItemsAndGatherFailures(DefaultAsyncWorkTracker.java:142)
Caused by: org.gradle.tooling.BuildException: Failed to process: /MyProject/app/build/intermediates/transforms/APMSPlugin/devGms/debug/57.jar
at com.android.build.gradle.internal.dexing.DexWorkAction.run(DexWorkAction.kt:59)
at com.android.build.gradle.internal.profile.ProfileAwareWorkAction.execute(ProfileAwareWorkAction.kt:74)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:66)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:62)
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:97)
Caused by: org.gradle.tooling.BuildException: Failed to process: /MyProject/app/build/intermediates/transforms/APMSPlugin/devGms/debug/57.jar
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:214)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
... 6 more
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process: /MyProject/app/build/intermediates/transforms/APMSPlugin/devGms/debug/57.jar
at com.android.build.gradle.internal.dexing.DexWorkActionKt.process(DexWorkAction.kt:193)
at com.android.build.gradle.internal.dexing.DexWorkActionKt.processNonIncrementally(DexWorkAction.kt:159)
at com.android.build.gradle.internal.dexing.DexWorkActionKt.launchProcessing(DexWorkAction.kt:86)
at com.android.build.gradle.internal.dexing.DexWorkAction.run(DexWorkAction.kt:49)
... 33 more
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
at com.android.builder.dexing.D8DexArchiveBuilder.getExceptionToRethrow(D8DexArchiveBuilder.java:141)
at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:118)
at com.android.build.gradle.internal.dexing.DexWorkActionKt.process(DexWorkAction.kt:189)
... 36 more
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: Lretrofit/client/ApacheClient$GenericHttpRequest;<init>(Lretrofit/client/Request;)V, origin: /MyProject/app/build/intermediates/transforms/APMSPlugin/devGms/debug/57.jar:retrofit/client/ApacheClient$GenericHttpRequest.class
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process: /MyProject/app/build/intermediates/transforms/APMSPlugin/devGms/debug/57.jar
at Version.fakeStackEntry(Version_2.2.71.java:0)
at com.android.tools.r8.utils.a0.a(SourceFile:89)
at com.android.tools.r8.D8.run(D8.java:11)
at com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:116)
... 37 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0
at com.android.tools.r8.ir.conversion.r.b(SourceFile:2)
at com.android.tools.r8.ir.conversion.r.c(SourceFile:5)
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
at com.android.tools.r8.ir.conversion.u.c(SourceFile:1)
at com.android.tools.r8.r.o.V.a(SourceFile:4164)
at com.android.tools.r8.ir.conversion.o.a(SourceFile:619)
at com.android.tools.r8.ir.conversion.S.a(SourceFile:259)
at com.android.tools.r8.graph.p.a(SourceFile:130)
at com.android.tools.r8.graph.p.b(SourceFile:11)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: Lretrofit/client/ApacheClient$GenericHttpRequest;<init>(Lretrofit/client/Request;)V, origin: /MyProject/app/build/intermediates/transforms/APMSPlugin/devGms/debug/57.jar:retrofit/client/ApacheClient$GenericHttpRequest.class
at com.android.tools.r8.graph.p.a(SourceFile:108)
at com.android.tools.r8.graph.h1.a(SourceFile:39)
at com.android.tools.r8.graph.M1.a(SourceFile:2)
at com.android.tools.r8.ir.conversion.T.a(SourceFile:603)
at com.android.tools.r8.utils.a0.a(SourceFile:124)
at com.android.tools.r8.ir.conversion.T.c(SourceFile:12)
Caused by: [CIRCULAR REFERENCE: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0]
> Task :app:dexBuilderDevGmsDebug FAILED
Execution failed for task ':app:dexBuilderDevGmsDebug'.
> There was a failure while executing work items
> A failure occurred while executing com.android.build.gradle.internal.dexing.DexWorkAction
> Failed to process: /MyProject/app/build/intermediates/transforms/APMSPlugin/devGms/debug/57.jar
This is my build.bradle (Global):
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.google.gms:google-services:4.3.13'
classpath 'com.dynatrace.tools.android:gradle-plugin:8.+'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10'
}
repositories {
maven {
google()
mavenCentral()
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// Define versions in a single place
ext {
junitVersion = '4.13.2'
mockitoVersion = '1.10.19'
powerMockito = '1.6.2'
hamcrestVersion = '1.3'
}
and this is build.gradle (:app)
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'kotlin-kapt'
}
android {
compileSdkVersion 31
ndkVersion "21.3.6528147"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
publishNonDefault true
defaultConfig {
applicationId "it.vit.ant"
versionName "9.1.0"
versionCode 8
minSdkVersion 24
targetSdkVersion 31
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
ndk {
abiFilters 'x86', 'x86_64', 'arm64-v8a', 'armeabi-v7a'
}
}
task ndkClean(type: Delete) {
delete fileTree('.externalNativeBuild') {
exclude defaultConfig.ndk.abiFilters.collect { '**/' + it }
}
}
tasks.findByPath(':clean').dependsOn ndkClean
lintOptions {
checkReleaseBuilds false
abortOnError false
ignoreWarnings false
}
dexOptions {
javaMaxHeapSize "4g"
}
signingConfigs {
release {
if (project.hasProperty('RELEASE_STORE_FILE')) {
println("Signing Key: " + RELEASE_STORE_FILE + ", alias: " + RELEASE_KEY_ALIAS)
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
}
buildTypes {
debug {
debuggable true
minifyEnabled false
shrinkResources false
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
testCoverageEnabled true
isDefault true
}
release {
debuggable false
minifyEnabled true
shrinkResources true
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
externalNativeBuild {
ndkBuild {
path 'src/main/jni/Android.mk'
}
}
productFlavors {
dev {
applicationIdSuffix = ".dev"
isDefault true
}
mock {
applicationIdSuffix = ".mock"
}
coll {
applicationIdSuffix = ".coll"
}
}
sourceSets {
main {
jniLibs.srcDirs = ['src/main/jniLibs']
java.srcDirs = ['src/main/java']
}
gms {
jniLibs.srcDirs = ['src/main/jniLibs']
java.srcDirs = ['src/main/java', 'src/gms/java']
//Google Services plugin - firebase dependency for push notification
apply plugin: "com.google.gms.google-services"
project.ext.set('usesGms', true)
project.ext.set('usesHms', false)
}
}
buildFeatures {
dataBinding true
}
}
dependencies {
implementation fileTree(dir: '../libs', include: ['*.jar', '*.aar'])
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.12.4'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.jakewharton:butterknife:10.2.3'
kapt 'com.jakewharton:butterknife-compiler:10.2.3'
implementation 'com.squareup.retrofit:retrofit:1.9.0'
implementation "com.squareup.okhttp3:okhttp:4.9.3"
implementation 'io.reactivex:rxjava:1.3.4'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'com.jakewharton.retrofit:retrofit1-okhttp3-client:1.1.0'
implementation 'commons-codec:commons-codec:1.15'
implementation 'com.google.dagger:dagger:2.31.2'
implementation 'com.google.dagger:dagger-android-support:2.31.2'
kapt 'com.google.dagger:dagger-compiler:2.31.2'
kapt 'com.google.dagger:dagger-android-processor:2.31.2'
implementation 'com.fasterxml.uuid:java-uuid-generator:4.0.1'
implementation 'com.journeyapps:zxing-android-embedded:3.5.0@aar'
implementation 'com.google.zxing:core:3.4.0'
implementation 'de.halfbit:pinned-section-listview:1.0.0'
implementation 'com.wdullaer:materialdatetimepicker:4.2.3'
implementation 'org.apache.commons:commons-lang3:3.10'
implementation 'com.tbruyelle.rxpermissions:rxpermissions:0.9.3@aar'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'
implementation 'net.cachapa.expandablelayout:expandablelayout:2.8'
implementation 'de.adorsys.android:securestoragelibrary:1.2.4'
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
implementation 'com.dynatrace.agent:agent-android:8.+'
implementation 'com.whiteelephant:monthandyearpicker:1.3.0'
testImplementation "junit:junit:$rootProject.ext.junitVersion"
testImplementation "org.mockito:mockito-core:$rootProject.ext.mockitoVersion"
testImplementation "org.mockito:mockito-all:$rootProject.ext.mockitoVersion"
testImplementation "org.hamcrest:hamcrest-all:$rootProject.ext.hamcrestVersion"
testImplementation "org.powermock:powermock-module-junit4:$rootProject.ext.powerMockito"
testImplementation "org.powermock:powermock-api-mockito:$rootProject.ext.powerMockito"
androidTestImplementation "org.mockito:mockito-core:$rootProject.ext.mockitoVersion"
androidTestImplementation 'com.google.dexmaker:dexmaker:1.2'
androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2'
androidTestImplementation("junit:junit:$rootProject.ext.junitVersion") {
exclude module: 'hamcrest-core'
}
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test:rules:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.annotation:annotation:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-idling-resource:3.4.0'
androidTestImplementation "com.android.support:support-annotations:$rootProject.supportLibraryVersion"
implementation 'com.whiteelephant:monthandyearpicker:1.3.0'
implementation 'com.google.android:flexbox:2.0.1'
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.0'
implementation 'androidx.fragment:fragment-ktx:1.5.0'
implementation 'com.squareup.picasso:picasso:2.8'
implementation 'androidx.biometric:biometric:1.1.0'
gmsImplementation 'com.google.firebase:firebase-messaging-ktx'
gmsImplementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.j256.two-factor-auth:two-factor-auth:1.3'
implementation 'com.cleafy.mobile.detection.android:agent:3.5.0:release@aar'
implementation "com.google.protobuf:protobuf-javalite:3.19.4"
implementation 'com.kofax.mobile:sdk:3.6.0.0.0.685@aar'
implementation 'com.kofax.android.abc:xvrs:3.5.0.1.0.450@jar'
implementation 'com.kofax.mobile:barcodeparser:3.5.0.0.0.12@jar'
implementation 'com.manateeworks:manatee:2.5.0.0.0.69@jar'
implementation 'com.kofax.android:isg:3.5.0.1.0.868@jar'
implementation 'com.kofax.mobile:commonextractionengine:3.5.0.1.0.389@jar'
implementation 'com.onespan:RootDetectionSDK:4.31.3@jar'
implementation 'com.onespan:UtilitiesSDK:4.31.3@aar'
implementation 'com.esotericsoftware:kryo:5.1.1'
implementation 'org.bouncycastle:bcprov-jdk15on:1.70'
}
Solution
I have finally found the solution and I am reporting it here for the benefit of anyone who might encounter the same problem. The error was due to a library with a bug. In the global build.gradle I have addressed the Dynatrace classpath like this:
classpath 'com.dynatrace.tools.android:gradle-plugin:8.+'
and in the build.gradle: app the Dynatrace library like so:
implementation 'com.dynatrace.agent: agent-android: 8. +'
The latest version of the Dynatrace lib at the moment is 8.249.1.1004 and it has the bug mentioned above. It was enough for me to change the addressing of the classpath and the library to the previous and working version, that is:
classpath 'com.dynatrace.tools.android:gradle-plugin:8.247.1.1003'
and
implementation 'com.dynatrace.agent: agent-android: 8.247.1.1003'
and the problem no longer arises. I hope this can help and save someone else's time, I took a lot of time to figure it out.
Answered By - vitiello.antonio
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.