i try run my application but suddenly arise this error
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
then i try searching and try that solution but all solution is not worked
help me :(
here is my .gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
defaultConfig {
applicationId 'com.inhatc.jh.yourplaylist'
minSdkVersion 20
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/jaudiotagger-2.2.4-SNAPSHOT.jar')
compile files('libs/glide-3.4.0.jar')
compile files('libs/google-api-services-youtube-v3-rev183-1.22.0.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.google.android.gms:play-services-auth:10.0.1'
// Google Api Client library and Android extension
compile 'com.google.api-client:google-api-client-android:1.22.0'
// Change to the API you want to access:
// Below is just an example for People REST API access
compile 'com.google.apis:google-api-services-people:v1-rev4-1.22.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
today solved my problem
i miss lib/.jar files and .gradle dependencies
Related
When I run my project in my phone or in the emulator, it works fine. However, when I try to build the APK, it raises an error.
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.dex.DexIndexOverflowException: method ID not in [0,
0xffff]: 65536
Here is my build.gradle.
apply plugin: 'com.android.application'
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.atm_locator.cbe.cbeatmlocator"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { debug { res.srcDirs = ['src/debug/res', 'src/debug/res/html'] } }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.volley:volley:1.0.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:0.7.2'
compile 'com.firebase:geofire-android:2.1.2'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.google.android.gms:play-services-vision:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'ai.api:libai:1.6.12'
compile 'ai.api:sdk:2.0.7#aar'
compile 'com.google.code.gson:gson:2.3'
compile 'commons-io:commons-io:2.4'
testCompile 'junit:junit:4.12'
compile files('libs/httpclient-4.5.jar')
}
apply plugin: 'com.google.gms.google-services'
What the error is telling you is that you've reached the method count limit in Android. This can be solved two ways: Either you start removing dependencies or you enable multidexing. The latter can be enabled the following way:
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 26
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
On Android API level >= 21 you don't need the compile dependency, as this is supported natively by ART.
You can read all about this on https://developer.android.com/studio/build/multidex
For release, I'd suggest to enable proGuard to optimize your app and automatically remove not needed code. For debug builds, to simplify debugging, as mentioned above, you can enable multidex.
For proguard, read documentation: https://developer.android.com/studio/build/shrink-code - configuration may be not straightforward
hi i write an app thats works on my phone (api 23,Android 6.0.1) but when i want to start the app on Geneymotion (virtual android device on api 17 )this error shows up
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.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
i write the app for that api but i dont know why this is happening
gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "app.mma.introsliderproject"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.github.halysongoncalves:pugnotification:1.8.1'
compile 'me.tatarka.support:jobscheduler:0.1.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:support-vector-drawable:24.2.1'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.victor:lib:1.0.4'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.sd6352051:NiftyDialogEffects:v1.0.2'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.github.flavienlaurent.discrollview:library:0.0.2#aar'
compile 'com.github.alxrm:animated-clock-icon:1.0.2'
compile 'com.google.firebase:firebase-crash:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
In your application level app.gradle add the following
in dependencies,
compile 'com.android.support:multidex:1.0.2'
in defaultConfig
multiDexEnabled true
If you use your own Application class then, change it as follows,
extends Application to extends MultiDexApplication
Also add this.
#Override
protected void attachBaseContext(Context newBase) {
MultiDex.install(newBase);
super.attachBaseContext(newBase);
}
If you don't use any custom Application, change your AndroidManifest.xml
<application
android:name="android.support.multidex.MultiDexApplication"
... >
</application>
Add this in your app build.gradle
configurations {
compile.exclude group:'com.android.support', module: 'support-v4'
compile.exclude group:'com.android.support', module: 'support-annotations'
}
This occurred after I upgraded my android studio. I've attempted all similar answers on stack overflow, and a few other obscure forums, but I'm not getting anywhere with this error and I've been at it for 6 hours. I've monkeyed around with the sdk tools manager as well, but I'm not getting anywhere. Oh, and that maven thing is new, tried it from a similar answer.
Here is my gradle file:
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.loredylore.lorebuilder"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:26.0.0-alpha1'
compile 'com.android.support:support-vector-drawable:26.0.0-alpha1'
compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
compile 'com.google.firebase:firebase-auth:11.0.2'
compile 'com.google.firebase:firebase-core:11.0.2'
compile 'com.google.firebase:firebase-database:11.0.2'
compile 'com.google.firebase:firebase-crash:11.0.2'
compile 'com.google.firebase:firebase-storage:11.0.2'
compile 'com.android.support:support-annotations:26.0.0-alpha1'
//new
testCompile 'junit:junit:4.12'
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'
use version 25.0.3, you may have to recast some views to text views when if you have to migrate backward from version 26 android to 25.
I am trying to use FirebaseListAdapter and for it , it requires
dependency of com.firebaseui:firebase-ui-database:1.2.0 . But when I add this in my gradle file I am getting an error in
com.android.support:appcompat-v7:25.3.1
below are the screenshot and code for app.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.ashish.internchat"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
}
apply plugin: 'com.google.gms.google-services'
This is the error I am getting:
You are using mismatching library versions. com.android.support:animated-vector-drawable is version 25.3.1 while your com.android.support:recyclerview-v7 is version 25.1.1. Using mismatched versions could cause your app to crash/errors. FirebaseUi must be using version 25.1.1.
Add the below to your apps gradle:
compile 'com.android.support:recyclerview-v7:25.3.1'
I am trying to build apk but I'm unable to create it.Getting the following errors.But project running successfully.my android studio version 2.2.2
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'. >
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
com/google/android/gms/common/api/zzd.class
my gradle file is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.wedding.weddingapp"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
configurations { all*.exclude module: 'gson-2.5' }
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url "https://raw.githubusercontent.com/layerhq/releases-android/master/releases/" }
maven { url "https://raw.githubusercontent.com/layerhq/Atlas-Android/master/releases/" }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:multidex:1.0.0'
compile 'com.layer.atlas:layer-atlas:0.3.6'
compile 'com.google.firebase:firebase-messaging:9.8.0'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.volley:volley:1.0.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.android.support:cardview-v7:25.1.0'
testCompile 'junit:junit:4.12'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
You are getting
TransformException: java.util.zip.ZipException: duplicate entry:
com/google/android/gms/common/api/zzd.class
You should use latest version of Firebase
compile 'com.google.firebase:firebase-messaging:10.0.1'
and use
buildToolsVersion "25.0.1"
Thean Clean-Rebuild-Restart your IDE