Building library failed with dex errors
See original GitHub issueDescription
Sync’d gradle, that went OK. Clean Project, that went OK. Then added Rebuild or run on device and it fails with:
Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/andres/.gradle/caches/transforms-1/files-1.1/leku-4.0.1.aar/349173a406929f5032ad2ef1e18bc511/jars/classes.jar
Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing com/schibstedspain/leku/geocoder/AndroidGeocoderDataSource.class
Error:com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/andres/.gradle/caches/transforms-1/files-1.1/leku-4.0.1.aar/349173a406929f5032ad2ef1e18bc511/jars/classes.jar
This issue is more for me as well to track my progress debugging this. I have a feeling that my machine might be the problem. So, I’m transferring my project to a new one just in case. Until then I’ll keep this updated here:
I tried adding minsdk to 26 and it did build but I can’t test it because I don’t have a 26 device. Originally I was loading the full google play services bundle as an implementation but then I got multidex and too many methods (dex) errors and reduced it just to maps and places/locations, that reduced my original 30+ errors to just the four above. Removing the leku library and instances, it builds just fine without errors or warnings. Attached is my app gradle file:
Info Required
-
Which version of the library do you actually use? 4.0.1
-
Do you have the localization permission granted?
-
Are you sending parameters to the activity through the bundle? N/A
-
Could you describe what are the actions do you make to raise that error? Building
-
Android monitor shows any log related to the library when the error is shown? N/A
-
Any other thing that could help me to reproduce the error?
Screenshots
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
repositories {
jcenter()
}
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.com"
minSdkVersion 24
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-std=c++11"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
dependencies {
//implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-annotations:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v13:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
//testImplementation 'junit:junit:4.12'
//androidTestImplementation 'com.android.support.test:runner:1.0.1'
//androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.github.boxme:squarecamera:1.1.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.google.android.gms:play-services-places:11.8.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.schibstedspain.android:leku:4.0.1'
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (5 by maintainers)
Top GitHub Comments
Adding following options to build.gradle file in app module helped me.
compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }
Solved