Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/measurement/zzabn;
:app:transformClassesWithDexForDebug FAILED
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: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_91\bin\java.exe'' finished with non-zero exit value 2
Here is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "24.0.3"
defaultConfig {
applicationId "quotspot.inext.quotspot"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.aurelhubert:ahbottomnavigation:0.1.3'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'com.google.firebase:firebase-core:15.0.0'
compile 'com.google.firebase:firebase-messaging:15.0.0'
compile 'com.google.firebase:firebase-storage:15.0.0'
compile 'com.firebaseui:firebase-ui:0.4.2'
compile 'com.google.firebase:firebase-database:15.0.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.0'
compile 'com.google.firebase:firebase-auth:15.0.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.google.firebase:firebase-firestore:15.0.0'
compile 'com.larswerkman:HoloColorPicker:1.5'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'com.android.support:multidex:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
Firebase was updated yesterday (5/2), causing the various firebase dependencies you are importing to go out of sync.
The solution is to update them to the latest version, which you can find by:
Go to Firebase release notes for the list of latest versions, or
open build.gradle file in Android Studio and see which Firebase dependencies are highlighted, put cursor above each of them to see the latest version number
try adding multiDexEnabled true in
android {
compileSdkVersion 27
defaultConfig {
applicationId "quotspot.inext.quotspot"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
To solve this, please change all these lines of code:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.aurelhubert:ahbottomnavigation:0.1.3'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'com.google.firebase:firebase-core:15.0.0'
compile 'com.google.firebase:firebase-messaging:15.0.0'
compile 'com.google.firebase:firebase-storage:15.0.0'
compile 'com.firebaseui:firebase-ui:0.4.2'
compile 'com.google.firebase:firebase-database:15.0.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.0'
compile 'com.google.firebase:firebase-auth:15.0.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.google.firebase:firebase-firestore:15.0.0'
compile 'com.larswerkman:HoloColorPicker:1.5'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'com.android.support:multidex:1.0.1'
}
to
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.aurelhubert:ahbottomnavigation:0.1.3'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'com.google.firebase:firebase-core:15.0.2'
compile 'com.google.firebase:firebase-messaging:15.0.2'
compile 'com.google.firebase:firebase-storage:15.0.2'
compile 'com.firebaseui:firebase-ui:3.3.1'
compile 'com.google.firebase:firebase-database:15.0.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.0'
compile 'com.google.firebase:firebase-auth:15.1.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.google.firebase:firebase-firestore:16.0.0'
compile 'com.larswerkman:HoloColorPicker:1.5'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'com.android.support:multidex:1.0.1'
}
For more informations, please see this link and this.
Related
I have a problem in build.gradle (Module app) that I can not resolve
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "ahmedchtn.smartschool"
minSdkVersion 17
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(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//RecyclerView
//retrofit,gson
//glide
compile 'com.github.bumptech.glide:glide:3.7.0'
//Displaying images
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v7:25.0.3'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
//Firebase UI
compile 'com.firebaseui:firebase-ui-auth:0.6.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
The error is shown in this line
compile 'com.android.support:appcompat-v7:23.4.0'
Error message:
All com.android.support libraries must use the exact same version specification(mixing versions can lead to runtime crashes).Found versions 25.3.1,23.4.0.Examples include
com.android.support:animated-vector-drawable:25.3.1 and
com.android.support:cardview-v7:23.4.0
Use same version to all dependencies of support libraries. In your case change these dependency version to "25.3.1".
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
I have a gradle dependencies.
When I add compile 'com.heinrichreimersoftware:material-intro:1.6'
I get error after gradle sync. => Attribute "titleTextColor" already defined with incompatible format.
Do you have someone with that experience?
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
versionCode 29
versionName "2.1"
multiDexEnabled true
}
...
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'com.github.johnpersano:supertoasts:1.3.4#aar'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'net.danlew:android.joda:2.3.3'
compile 'eu.inmite.android.lib:android-styled-dialogs:1.2.0'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.android.support:design:22.2.1'
compile 'com.github.blackfizz:eazegraph:1.2.5l#aar'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.3.1'
compile 'com.github.clans:fab:1.6.4'
compile 'com.heinrichreimersoftware:material-intro:1.6'
compile('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true;
}
}
The com.heinrichreimersoftware:material-intro:1.6 has this dependency:
compile 'com.android.support:appcompat-v7:24.2.0'
Since it is using the v24 you have to use compileSdkVersion 24 and you should use the same level in your dependencies.
The message is
Error:(27, 0) Could not find property 'compile' on org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated#64d9a7e6.
Open File
When I press Open file I'm taken to my build.gradle for my project, and I think it's trying to show me my dependancies. Here is what that page looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.myname.myappname"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
def var = dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.google.android.gms:play-services:9.2.1'
compile
'com.android.support:appcompat-v7:24.1.1' compile
'com.squareup.okhttp:okhttp:2.7.2' compile
'com.jakewharton:butterknife:7.0.1' compile
'com.android.support:design:24.1.1' compile
'com.android.support:multidex:1.0.1' compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.yayandroid:LocationManager:1.1.2'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-identity:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
}
Also, var (from def var = dependancies) is greyed out and it says "assignment not used" when I mouse over it, though I don't know if this is related. I was using a version from a year ago or so, but I'm able to use some of my other projects in the new version.
def var = dependencies { seems to be nonsense, it should simply be dependencies {, this is no error though, just nonsense.
I think your problem is shifted newlines. The whole block
def var = dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.google.android.gms:play-services:9.2.1'
compile
'com.android.support:appcompat-v7:24.1.1' compile
'com.squareup.okhttp:okhttp:2.7.2' compile
'com.jakewharton:butterknife:7.0.1' compile
'com.android.support:design:24.1.1' compile
'com.android.support:multidex:1.0.1' compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.yayandroid:LocationManager:1.1.2'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-identity:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
}
should probably be
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.google.android.gms:play-services:9.2.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.squareup.okhttp:okhttp:2.7.2'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.yayandroid:LocationManager:1.1.2'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-identity:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
}
and everything should work again.
this my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "done.ui"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.+'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.facebook.android:facebook-android-sdk:4.2.0'
compile 'com.pubnub:pubnub-android:3.7.4'
compile 'com.amazonaws:aws-android-sdk-core:2.+'
compile 'com.amazonaws:aws-android-sdk-cognito:2.+'
compile 'com.amazonaws:aws-android-sdk-ddb:2.+'
compile 'com.amazonaws:aws-android-sdk-ddb-mapper:2.+'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.github.clans:fab:1.5.5'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.kanytu:android-parallax-recyclerview:v1.4'
compile files('libs/PayPalAndroidSDK-2.8.5.jar')
}
message gradle build after run project
this error
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_80\bin\java.exe'' finished with non-zero exit value 2
Try this
You use buildToolsVersion 22 and your compileSdkVersion and targetSdkVersion is 21
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "done.ui"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
}
}
dependencies {
compile fileTree(dir: 'libs', exclude: 'android-support-v4.jar', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.+'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.facebook.android:facebook-android-sdk:4.2.0'
compile 'com.pubnub:pubnub-android:3.7.4'
compile 'com.amazonaws:aws-android-sdk-core:2.+'
compile 'com.amazonaws:aws-android-sdk-cognito:2.+'
compile 'com.amazonaws:aws-android-sdk-ddb:2.+'
compile 'com.amazonaws:aws-android-sdk-ddb-mapper:2.+'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.github.clans:fab:1.5.5'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.kanytu:android-parallax-recyclerview:v1.4'
compile files('libs/PayPalAndroidSDK-2.8.5.jar')
}
dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])//<==Just comment this line
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.+'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.facebook.android:facebook-android-sdk:4.2.0'
compile 'com.pubnub:pubnub-android:3.7.4'
compile 'com.amazonaws:aws-android-sdk-core:2.+'
compile 'com.amazonaws:aws-android-sdk-cognito:2.+'
compile 'com.amazonaws:aws-android-sdk-ddb:2.+'
compile 'com.amazonaws:aws-android-sdk-ddb-mapper:2.+'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.github.clans:fab:1.5.5'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.kanytu:android-parallax-recyclerview:v1.4'
compile files('libs/PayPalAndroidSDK-2.8.5.jar')
}
comment this line and re-build again that's it compile fileTree(dir: 'libs', include: ['*.jar'])
and don't forget to add this
defaultConfig {
...
multiDexEnabled true
}
Use --debug option to get more detailed output.
It is possible that you have dependencies conflict and dex trying to process same class file from different libraries and failing. If this is the case you should filter out libraries you don't need.
use:
compile ("alibpath") {
transitive = false
}
to skip transitive libraries.
The other possibility is that you have java.* javax.* classes in your libs, dex doesn't like it.
I make one project like below structure
my build.gradel file as below
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "pkg.com.appname"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
/*compile fileTree(dir: 'libs', include: ['*.jar'])*/
compile 'com.android.support:appcompat-v7:22.2.1'
compile files('libs/commons-io-2.4.jar')
compile files('libs/achartengine-1.1.0.jar')
compile files('libs/apache-mime4j-0.6.jar')
compile files('libs/itextpdf-5.1.0.jar')
compile files('libs/android-support-v4.jar')
compile files('libs/gson-2.1.jar')
compile files('libs/json_simple-1.1.jar')
compile files('libs/httpmime-4.0.1.jar')
compile files('libs/droidText.0.2.jar')
compile files('libs/ormlite-android-4.48.jar')
compile files('libs/opencsv-2.4.jar')
compile files('libs/ormlite-core-4.48.jar')
compile 'com.google.android.gms:play-services:7.5.0'
}
I tried all possibility as per current accepted answer like below
1. Comment dependency lib line form build.gradle
dependencies {
/*compile fileTree(dir: 'libs', include: ['*.jar'])*/
compile 'com.android.support:appcompat-v7:22.2.1'
compile files('libs/commons-io-2.4.jar')
compile files('libs/achartengine-1.1.0.jar')
compile files('libs/apache-mime4j-0.6.jar')
compile files('libs/itextpdf-5.1.0.jar')
compile files('libs/android-support-v4.jar')
compile files('libs/gson-2.1.jar')
compile files('libs/json_simple-1.1.jar')
compile files('libs/httpmime-4.0.1.jar')
compile files('libs/droidText.0.2.jar')
compile files('libs/ormlite-android-4.48.jar')
compile files('libs/opencsv-2.4.jar')
compile files('libs/ormlite-core-4.48.jar')
compile 'com.google.android.gms:play-services:7.5.0'
}
but if i remove this than in my class file getting error like your library is missing for this class
2. By making change line as compile to provided
when i making above change than my application not run and give message like like null pointer due to library not getting to respective class.
So i m getting confuse which way i follow for this any idea how can i solve this problem? your all suggestions are appreciable.
In defaultConfig add :
multiDexEnabled = true
And in same build.gradle add :
dexOptions {
javaMaxHeapSize "4g"
}
And in dependencies add :
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.0'}