I am creating a project that uses java lamda expressions and so I recently switched to Android 3. My project builds successfully but throws an exception at runtime as follows: -
Error: execution completed for task ': app: transformDexArchiveWithExternalLibsDexMergerForDebug'. java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: cannot merge dex
Build.gradle project level: -
buildscript { repositories { jcenter() maven { url "https://jitpack.io" } google() } dependencies { classpath 'com.android.tools.build:gradle:3.0.0-rc2' } } allprojects { repositories { jcenter() maven { url "https://jitpack.io" } google() } } task clean(type: Delete) { delete rootProject.buildDir }
Build.gradle application level: -
apply plugin: 'com.android.application' android { compileSdkVersion 26 buildToolsVersion '26.0.2' defaultConfig { applicationId "com.example.project" minSdkVersion 24 targetSdkVersion 26 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' } } configurations.all { resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9' } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.android.support:multidex:1.0.2' implementation project(":app:libs:myfolder") testImplementation 'junit:junit:4.12'
}
Gradlew output --stacktrace: https://ghostbin.com/paste/3kebt
I tried the clean and rebuild method, and the other methods mentioned in other stackoverflow answers answered a similar question. But nothing works.
Edit: it has already been mentioned that none of the Dex error methods on Android Studio 3.0 Beta4 works in my case, and therefore this is not the same case, and this is not a duplicate question.
So I need help solving this problem. Thanks in advance.
java android dex
Ronaldo7 Oct 21 '17 at 11:22 2017-10-21 11:22
source share