Studio : Execution failed for task app:transformClassesWithJarMergingForDebug - android

I got this below error in gradle build Messages
.I tried many Stackoverflow post relevant to this issue.But nothing worked for me.
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
android/support/annotation/IntegerRes.class
Edit:
app/build.gradle:
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.golive.vernon"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dexOptions {
//incremental = true;
preDexLibraries = false
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/NOTICE.txt' // will not include NOTICE file
exclude 'META-INF/LICENSE.txt' // will not include LICENSE file
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.android.gms:play-services:+'
compile files('libs/gcm.jar')
compile files('libs/glide-3.6.1.jar')
compile files('libs/httpcore-4.3-beta1.jar')
compile files('libs/httpmime-4.3.jar')
compile files('libs/universal-image-loader-1.9.5.jar')
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.0'
compile project(':facebook')
compile project(':InstaLibrary')
compile project(':simple-crop-image-lib')
compile files('libs/twitter4j-core-4.0.4.jar')
compile 'com.android.support:multidex:1.0.1'
}
Below I have added the libs screenshot:
Below I have added the dependencies list:
Manifest:
>
Appcontroller.java:
#Override
public void onCreate() {
super.onCreate();
MultiDex.install(this);
mInstance = this;
}

In your Gradle Compile with support:multidex and add also dexOptions
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
..............
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dexOptions {
//incremental = true;
preDexLibraries = false
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/NOTICE.txt' // will not include NOTICE file
exclude 'META-INF/LICENSE.txt' // will not include LICENSE file
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile files('libs/gcm.jar')
compile files('libs/glide-3.6.1.jar')
compile files('libs/httpcore-4.3-beta1.jar')
compile files('libs/httpmime-4.3.jar')
compile files('libs/universal-image-loader-1.9.5.jar')
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.0'
compile project(':facebook')
compile project(':InstaLibrary')
compile project(':simple-crop-image-lib')
compile files('libs/twitter4j-core-4.0.4.jar')
compile 'com.android.support:multidex:1.0.1'
}
In Your AndroidManifest.xml add this lines android:name
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:name="android.support.multidex.MultiDexApplication"
>
If also an error than compile
compile 'com.google.android.gms:play-services:+'
Instead OF
compile 'com.google.android.gms:play-services-maps:8.4.0'

After followed Er. Arjun saini answer referred to adding multidex & licence and I have corrected adding facebook sdk to solve this issue:
previously, I had added the Facebook library by adding import module.
Wrong Way :
compile project(':facebook')
Right Way:
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
And also In top-level build.gradle:
allprojects {
repositories {
jcenter() // This is the default repo
mavenCentral() // This is the Maven Central repo
}
}

Related

Android Studio - No Resource found that matches the name

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

Error:Execution failed for task ':app:transformJackWithJackForRelease'

I am getting the following error while building signed APK
Error:Execution failed for task ':app:transformJackWithJackForRelease'
com.android.build.api.transform.TransformException:
com.android.builder.core.JackToolchain$ToolchainException: Jack configuration exception.
Error while parsing '/Users/omprakash/.android/build-cache/44cf3550bd071d5e2184a0fbb6e8da24ff70e1cb/output/proguard.txt':2
The app is running fine in debug mode.
But when I am building the signed APK I am getting the above error. Tried changing the buildToolVersion but it didn't help. I also have MyApplication class extending MultiDexApplication.
The following is my gradle file:-
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 26
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.omagrahari"
manifestPlaceholders = [onesignal_app_id : "9727c212-****-****-**********",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "21051******"]
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
buildTypes {
release {
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
cruncherEnabled = false
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
dexOptions {
incremental true
preDexLibraries false
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
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.zendesk:sdk:1.11.0.1#aar') {
transitive = true;
}
compile('io.fabric.sdk.android:fabric:1.4.1#aar') {
transitive = true;
}
compile 'com.android.volley:volley:1.0.0'
compile 'com.github.d-max:spots-dialog:0.7#aar'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.+'
compile 'uk.co.chrisjenx:calligraphy:2.3.0'
compile 'com.android.support:cardview-v7:21.0.3'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.google.android.gms:play-services-maps:9.2.0'
compile 'com.google.android.gms:play-services-location:9.2.0'
compile 'com.google.android.gms:play-services-gcm:9.2.0'
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
compile 'com.github.lzyzsd:circleprogress:1.2.1'
compile 'com.cjj.materialrefeshlayout:library:1.3.0'
compile 'com.balysv:material-ripple:1.0.2'
compile 'com.cocosw:bottomsheet:1.+#aar'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'io.reactivex.rxjava2:rxjava:2.0.2'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'me.relex:circleindicator:1.2.2#aar'
compile 'com.squareup.okhttp3:okhttp:3.9.1'
compile 'com.github.bumptech.glide:glide:4.3.1'
compile 'com.sendbird.sdk:sendbird-android-sdk:3.0.43'
compile 'com.googlecode.libphonenumber:libphonenumber:8.4.2'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1'
compile 'com.onesignal:OneSignal:3.+#aar'
}
I don't get how to solve this. Please help.

Android Error:Execution failed for task ':app:transformClassesWithDexForDebug'

I have worked in android project in android studio, When i start run gradle build and the following errors shown. Anyone help me what is the problem
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 3
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.stage.lookara"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile files('libs/twitter4j-core-4.0.4.jar')
compile files('libs/slider.jar')
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.etsy.android.grid:library:1.0.5'
compile 'com.baoyz.swipemenulistview:library:1.3.0'
compile files('libs/universal-image-loader-1.9.5.jar')
compile 'com.github.darsh2:MultipleImageSelect:v0.0.3'
compile files('libs/pherialize-1.2.1.jar')
compile 'com.wang.avi:library:2.1.3'
compile 'com.mikhaellopez:circularprogressbar:1.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile
'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
compile 'com.felipecsl:gifimageview:2.1.0'
}
repositories {
jcenter()
}
dependencies {
compile 'org.adw.library:discrete-seekbar:1.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
compile 'org.jsoup:jsoup:1.7.3'
}
You are compiling the whole Google play services library:
compile 'com.google.android.gms:play-services:8.3.0'
which can cross the 64K reference limit' during compiling..
See this
if u just use some services from the library you can Selectively compiling APIs into your executable
Like:
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.android.gms:play-services-plus:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
I would also suggest to use latest version of play services compile 'com.google.android.gms:play-services:10.2.1'
2nd Way
If you really want to use the whole library : Enable Multidex in your application.
in your Gradle:
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 25
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
in Application class:
public class MyApplication extends SomeOtherApplication {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Define the application class in manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
</manifest>
Try clean first.
If it does not works, add multiDexEnabled to your build.gradle file.
defaultConfig {
multiDexEnabled true
}
See this: com.android.build.transform.api.TransformException

TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/util/MapCollections$ArrayIterator.class

this is my project build.gradle file .whenever i run the project in android studio i get the duplicate entry: android/support/v4/util/MapCollections$ArrayIterator.class error
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.aitsolution.bizitapp.bizit"
minSdkVersion 16
targetSdkVersion 23
versionCode 14
versionName "1.13"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
dexOptions {
javaMaxHeapSize "3g"
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
dependencies {
// compile fileTree(include: ['*.jar'], dir: 'libs')
// testCompile 'junit:junit:4.12'
compile files('libs/linkedin-j-android.jar')
compile files('libs/MobileOcrEngine.jar')
compile files('libs/signpost-core-1.2.1.1.jar')
compile files('libs/twitter4j-core-3.0.5.jar')
compile files('libs/ksoap2_2.6.0.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.android.gms:play-services-appindexing:9.0.0'
compile 'com.android.support:cardview-v7:23.3.+'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.edmodo:cropper:1.0.1'
}
I think facebook sdk comes with v4-support library exclude that and try.
compile ('com.facebook.android:facebook-android-sdk:4.6.0') {
exclude module: 'support-v4'
}

Pushy Integration Execution failed for task ':app:transformClassesWithJarMergingForDebug'

I am attempting to integrate Pushy (https://pushy.me/) into my app to allow for more reliable real-time notifications, in place of GCM.
However, upon attempting to run the app, the error below appears:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/fasterxml/jackson/core/base/GeneratorBase$1.class
Below is my build.gradle class:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1" // 22.0.1
defaultConfig {
applicationId "com.example.android.myapp2"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
dataBinding {
enabled = true
}
}
dependencies {
compile 'com.android.support:design:23.1.0'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.firebase:firebase-client-android:2.5.1+'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
I have attempted to clean, rebuild, but nothing helps.
How can I alleviate this issue?
After contacting the support line, I simply needed to prevent duplicate references of the jackson library:
configurations {
all*.exclude group: 'com.fasterxml.jackson.core'
}
and changed the dependencies to:
dependencies {
compile 'com.android.support:design:23.1.0'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.firebase:firebase-client-android:2.5.1+'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile files('libs/pushy-1.0.7.jar') //** Specified **
}

Categories

Resources