Hello guys this is the error which I faced while I was running the app. I am fresher to android so I cant get the results.I already gone through some tech websites it suggested to change versions (compile SDK version and Build tools version ) yet I cant solve this. Can any one help me to solve this ?.
Error Message :
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Android Build.gradle file.
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.24.4'
}
}
apply plugin: 'com.android.application'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'io.fabric'
android {
compileSdkVersion 25
buildToolsVersion "26.0.2"
repositories {
maven {
url 'https://maven.google.com'
}
maven { url 'https://maven.fabric.io/public' }
}
defaultConfig {
applicationId "com.smartgladiator.link"
minSdkVersion 21
targetSdkVersion 25
// Enabling multidex support.
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
versionCode 2
// versionName "1.0.37.1"
versionName "1.0.38"
}
dexOptions {
jumboMode true
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
zipAlignEnabled true
debuggable false
lintOptions {
disable 'MissingTranslation'
disable 'ResourceType'
}
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:customtabs:25.4.0'
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support:support-v13:25.4.0'
//compile 'com.android.support:multidex:1.0.1'
//to make supported components
compile 'com.android.support:support-v4:25.4.0'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'org.glassfish.tyrus.tests.servlet:tyrus-tests-servlet-autobahn-server:1.12'
compile 'org.glassfish.tyrus.tests:tyrus-tests-servlet-autobahn-server:1.0-b13'
compile 'com.github.nkzawa:socket.io-client:0.3.0'
compile 'com.baoyz.actionsheet:library:1.1.7'
compile 'com.baoyz.swipemenulistview:library:1.3.0'
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.makeramen:roundedimageview:2.3.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.7.3'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.3.1'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile project(':speech')
// debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4'
}
Make sure android sdk localtion is set correctly
ANDROID_HOME = home/user/android_sdk/ "this is correct location"
ANDROID_HOME = home/user/android_sdk/tools "wrong path"
or
downgrade your gradle version
Related
I am facing an issue in Android studio
I have tried to update the recent build-tools version to 27.0.1 and SDK version to 28 but it throws the exception
Update:
I have mentioned the app level build.gradle file content below,
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '27.0.1'
dexOptions {
jumboMode true
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "XXXX.XXXX.XXXX"
minSdkVersion 17
targetSdkVersion 25
versionCode 27
versionName "1.0.19"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support.constraint:constraint-layout:1.0.2'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.firebase:firebase-crash:11.8.0'
compile 'com.google.android.gms:play-services-gcm:11.8.0'
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:design:+'
compile 'com.liferay.mobile:liferay-screens:2.1.1'
compile 'com.liferay.mobile:liferay-material-viewset:2.1.1'
compile 'com.android.support:support-v4:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:cardview-v7:+'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'com.android.volley:volley:1.0.0'
testCompile 'junit:junit:4.12'
compile 'com.android.support:exifinterface:+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.woxthebox:draglistview:1.5.1'
compile 'com.github.lzyzsd:circleprogress:+'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
compile 'me.gujun.android.taggroup:library:1.4#aar'
compile 'com.akexorcist:RoundCornerProgressBar:2.0.3'
compile 'com.prolificinteractive:material-calendarview:1.4.3'
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
maven { url "http://dl.bintray.com/nhpatt/liferay-mobile" }
google()
}
}
apply plugin: 'com.google.gms.google-services'
Please anyone help to find out the solution.
It seems like a strange issue in Android Studio. Found a Workaround from this post.
Thanks to Veener who has posted the answer that actually solved the issue.
Just check whether the auto import libraries is working. Whether the studio is importing te required libraries in your maiƱ activity
I have Android Studio 3.0.1. After added new library, when I tried launching the app it did not launch with the message:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
But I don't know how to solve this error. I googled this but with no success.
My app gradle:
apply plugin: 'com.android.application' android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.xxxxxxx.app"
minSdkVersion 15
targetSdkVersion 26
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
versionCode 3
versionName "1.0.1"
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:multidex:1.0.2'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:26.1.0'
compile 'com.android.volley:volley:1.0.0'
compile files('libs/KGJsonConverter.jar')
compile files('libs/gson-2.2.4.jar')
compile 'com.github.amigold.fundapter:library:1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile files('libs/PhotoUtil.jar')
compile files('libs/GenAsync.1.2.jar')
compile files('libs/MD5Simply.jar')
compile 'com.soundcloud.android:android-crop:1.0.1#aar'
compile 'com.quickblox:quickblox-android-sdk-core:3.3.0'
compile 'com.quickblox:quickblox-android-sdk-chat:3.3.0'}
my project gradle:
buildscript {
repositories {
jcenter()
google()
} dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'}}allprojects {
repositories {
jcenter()
google() maven{ url 'https://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/'}}}task clean(type: Delete) { delete rootProject.buildDir}
Use the dependencies below.
compile 'com.quickblox:quickblox-android-sdk-videochat-webrtc:3.3.3#aar'
compile 'com.quickblox:quickblox-android-sdk-content:3.3.3#aar'
compile('com.quickblox:quickblox-android-sdk-chat:3.3.3#aar') {
transitive = true
}
This error appears after I updated to Android Studio 3.0. I tried many ways in many similar questions, but nothing works.
Here is the error:
I realized that when I remove the library 'com.google.android.gms:play-services-maps:11.4.2' my project build successful. But I need this library in my project, anyone knows how to deal with this problem?
My complete build.gradle.
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "vn.com.ttsoft.dhd"
minSdkVersion 21
targetSdkVersion 25
versionCode 14
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
useLibrary 'org.apache.http.legacy'
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
// Disable fabric build ID generation for debug builds
ext.enableCrashlytics = false
}
}
productFlavors {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
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/android-async-http-1.4.4.jar')
compile files('libs/google-play-services.jar')
compile files('libs/gson-2.3.1.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile 'com.github.pavlospt:roundedletterview:1.2'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.google.android.gms:play-services-maps:11.4.2'
compile 'me.tatarka.support:jobscheduler:0.1.1'
compile 'com.evernote:android-job:1.1.8'
testCompile 'junit:junit:4.12'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/mail.jar')
}
I am putting the gradle file you can use it may help you
apply plugin: 'com.android.application'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "vn.com.ttsoft.dhd"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
// Disable fabric build ID generation for debug builds
ext.enableCrashlytics = false
}
}
}
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'
})
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile files('libs/android-async-http-1.4.4.jar')
compile files('libs/google-play-services.jar')
compile files('libs/gson-2.3.1.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') {
transitive = true;
}
compile 'com.github.pavlospt:roundedletterview:1.2'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:support-v4:25.3.0'
compile 'me.tatarka.support:jobscheduler:0.1.1'
compile 'com.evernote:android-job:1.1.8'
testCompile 'junit:junit:4.12'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/mail.jar')
}
apply plugin: 'io.fabric'
and another project gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'io.fabric.tools:gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
I was also facing the same issue and I think something is wrong with google play services dependencies so I got it resolved by adding all below google play services dependencies :
compile 'com.google.android.gms:play-services-base:11.4.2'
compile 'com.google.android.gms:play-services-auth:11.4.2'
compile 'com.google.firebase:firebase-core:11.4.2'
compile 'com.google.firebase:firebase-messaging:11.4.2'
compile 'com.google.android.gms:play-services-gcm:11.4.2'
compile 'com.google.android.gms:play-services-location:11.4.2'
compile 'com.google.android.gms:play-services-maps:11.4.2'
compile 'com.google.android.gms:play-services-places:11.4.2'
I had a similar problem with the 'Multiple Dex' build error after upgrading to AS 3.0 / Gradle 3.0.0.
I found that the invalidate caches and restart, clean project, and minifyEnabled "solutions" were all red herrings.
I struggled with this for a few hours then found out what was causing my problem.
I was compiling Picasso, GSON and SQLiteAssetHelper using the statements
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.squareup.picasso:picasso:2.5.2'
...but I also had the sqliteassethelper, GSON and Picasso .jar files being compiled from my \libs folder.
compile fileTree(include: ['*.jar'], dir: 'libs')
Hence the duplicates.
Yes - pretty obvious but sometimes you can't see the wood for the trees!
I hope this helps someone.
(Final Note: compile command is deprecated in Gradle 3.0.0, therefore you might wish to change the above commands from compile to implementation)
What version of Play Services do you load from file? I guess that's an issue, you try to load whole play services and partial play-services-maps together. Also that explains the fact that, when you remove maps, everything works fine.
take a look on this link for selective compiling play services APIs, this will also help to reduce method count
https://developers.google.com/android/guides/setup
To somebody who is using android-async-http and had tried enable DEX, invalidate cache, delete .gradle files and check duplicate import/version:
I have some conflict in org.apache and android-async-http packages,
after I change i.e. org.apache.http.Header
to cz.msebera.android.httpclient.Header, my problem solved.
{
useLibrary 'org.apache.http.legacy' // avoid this
}
dependencies {
compile files('libs/android-async-http-1.4.4.jar') // only keep this one
}
I know this question is asked several times. I have been trying for over 3 hours with various solutions found but none of them worked for me.
When I run the application, it works well, but when I try to build APK it is giving me the following error:
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
com/google/android/gms/internal/zzcn$zza.class
I had taken the build successfully before I added firebase for FCM notification. After FCM was added, I had dex error, so I had to add support for multidex. I am also using YouTube player jar file.
This is my Gradle file:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.sample.application"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
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.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.facebook.android:audience-network-sdk:4.+'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
The issue is that com.facebook.android:audience-network-sdk has dependency : play-services-ads:8.4.0 which doesn't match the 10.0.1 version
replace :
compile 'com.facebook.android:audience-network-sdk:4.+'
compile 'com.google.firebase:firebase-messaging:10.0.1'
with :
compile ('com.facebook.android:audience-network-sdk:4.+'){
exclude group: "com.google.android.gms"
}
compile 'com.google.android.gms:play-services-ads:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
Android studio build issue Google sign in and Firebase latest version 10.2.4
google sign in was working fine until I have put firebase jar in gradle and its throwing "Error:(149, 28) The type com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable cannot be found in source files, imported jack libs or the classpath"
below is app level build
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "viksit.com.viksit.pro.viksitpro"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
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'
}
android {
useLibrary 'org.apache.http.legacy'
}
compile project(':linkedin-sdk')
compile(group: 'org.simpleframework', name: 'simple-xml', version: '2.7.1') {
exclude group: 'xpp3', module: 'xpp3'
}
compile('com.udojava:EvalEx:1.0') {
exclude group: 'junit', module: 'junit'
}
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.android.support:appcompat-v7:25.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.facebook.android:facebook-android-sdk:4.18.0'
compile 'com.afollestad.material-dialogs:commons:0.9.4.2'
compile 'com.google.firebase:firebase-database:10.2.4'
compile 'com.google.firebase:firebase-core:10.2.4'
compile 'com.google.firebase:firebase-auth:10.2.4'
compile 'com.google.android.gms:play-services-auth:10.2.4'
compile 'com.google.gms:google-services:3.0.0'
compile 'com.android.support:support-v4:25.0.2'
compile 'com.felipecsl:gifimageview:2.1.0'
compile 'me.itangqi.waveloadingview:library:0.3.5'
compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
compile 'com.github.siyamed:android-shape-imageview:0.9.+#aar'
compile 'com.android.support:design:25.3.0'
compile 'com.github.vipulasri:timelineview:1.0.5'
compile 'com.jaredrummler:material-spinner:1.1.0'
compile 'com.bignerdranch.android:expandablerecyclerview:3.0.0-RC1'
compile 'com.truizlop.sectionedrecyclerview:library:1.2.0'
compile 'com.github.castorflex.verticalviewpager:library:19.0.1'
compile 'link.fls:swipestack:0.3.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.3'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.+'
testCompile 'junit:junit:4.12'
}
below is project level build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Looks like you skipped this step
apply plugin: 'com.google.gms.google-services' line be at the bottom of your app/build.gradle file
https://developers.google.com/android/guides/google-services-plugin
Sidenote: You have Glide and Picasso, two-way gif drawable libraries, and two shaped imageview libraries. Each pair do the same thing. Clean out your dependencies to reduce your app size and chances of errors
I had a similiar problem with firebase yesterday and this worked for me:
Just add this to gradle file and rebuild it:
android {
....
dexOptions {
// Prevent OutOfMemory with MultiDex during the build phase
javaMaxHeapSize "4g"
}
}