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

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.

Related

compilation variants for firebase in android studio (productFlavors)

I am trying to make compilation variants for firebase, where I have two folders one prd and another qas in each folder are the google-services.json. But it shows me the error:
Error:Execution failed for task ':app:processQasDebugManifest'.
Manifest merger failed : Attribute provider#com.google.firebase.provider.FirebaseInitProvider#authorities value=(com.it.mobile.hansa.hbm.firebaseinitprovider) from AndroidManifest.xml:276:13-79
is also present at [com.google.firebase:firebase-common:11.8.0] AndroidManifest.xml:10:13-72 value=(com.it.mobile.hansa.hbm.qas.firebaseinitprovider).
Suggestion: add 'tools:replace="android:authorities"' to element at AndroidManifest.xml:274:9-278:39 to override.
This is my gradle module:
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.it.mobile.hansa.hbm"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
flavorDimensions "default"
productFlavors {
qas {
applicationId 'com.it.mobile.hansa.hbm.qas'
}
prd {
applicationId 'com.it.mobile.hansa.hbm'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':horizontalcalendar')
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.+'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.google.android.gms:play-services:11.8.0'
compile 'com.google.android.gms:play-services-maps:11.8.0'
compile 'com.google.android.gms:play-services-location:11.8.0'
compile 'com.android.support.constraint:constraint-layout:1.1.0-beta4'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.google.code.gson:gson:2.8.1'
compile 'commons-codec:commons-codec:1.10'
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.firebaseui:firebase-ui-database:3.1.0'
compile 'com.google.firebase:firebase-database:11.8.0'
compile 'com.google.firebase:firebase-storage:11.8.0'
testCompile 'junit:junit:4.12'
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services'
repositories {
mavenCentral()
}
apply plugin: 'kotlin-android-extensions'

Android Studio error import library

I have 2 projects. in first - library (android-range-seek-bar from GitHub) work fine
but after copy to second project - I have errors. Very strange errors (for me). Rebuild, clear, invalidate caches not helped :(
add dependencies in app gradle:
compile project(':rangeseekbar')
and settings.gradle is:
include ..., ':rangeseekbar', ...
project(':rangeseekbar').projectDir = new File('app/libs/rangeseekbar')
my xml is:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:rsb="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
...
<org.florescu.android.rangeseekbar.RangeSeekBar
android:id="#+id/yourage"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="15dp"
android:layout_weight="0.74"
rsb:absoluteMaxValue="60"
rsb:absoluteMinValue="14"
rsb:activateOnDefaultValues="true"
rsb:barHeight="2dp"
rsb:internalPadding="2dp"
rsb:singleThumb="true"/>
...
</ScrollView>
But Android studio tell me: [editor screenshot with problem] https://i.stack.imgur.com/7fPDt.jpg
so i have added from first project 3 libs: awesomevalidation, rangeseekbar, wizardpager - all this libs imported with error: [screenshot] https://i.stack.imgur.com/W8n6w.jpg
FIRST app (normal) gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "bla.bla.bla"
minSdkVersion 15
targetSdkVersion 23
versionCode 10
versionName '1.0'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
lintOptions {
checkReleaseBuilds false
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v13:25.3.1'
compile 'com.android.support:gridlayout-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile project(':fancybuttons')
compile project(':ckchangelog')
compile project(':appintro')
compile project(':rangeseekbar')
compile project(':segmentedcontrol')
compile project(':awesomevalidation')
compile project(':wizardpager')
compile project(':bubbleview')
compile project(':dialogplus')
compile project(':processbutton')
compile project(':androidquery')
}
SECOND app (problem) gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "bla.bla"
targetSdkVersion 26
versionCode 1
versionName "1"
multiDexEnabled true
}
productFlavors {
dev {
minSdkVersion 16
}
prod {
minSdkVersion 16
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
dexOptions {
javaMaxHeapSize "2g"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
dependencies {
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:mediarouter-v7:26.0.0-alpha1'
compile 'com.android.support:support-v13:26.0.0-alpha1'
compile 'com.google.android.gms:play-services:11.0.0'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support:support-annotations:26.0.0-alpha1'
compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.kbeanie:image-chooser-library:1.6.0#aar'
compile 'com.mobsandgeeks:android-saripaar:2.0.3'
compile 'com.wdullaer:materialdatetimepicker:3.1.3'
compile 'com.jaedongchicken:ytplayer:1.2.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
compile 'com.squareup.okio:okio:1.11.0'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'com.intellij:annotations:12.0'
compile 'com.patrickpissurno:ripple-effect:1.3.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.maps.android:android-maps-utils:0.4.3'
compile 'com.gvillani:pinnedlist:0.9.2'
compile 'com.github.lzyzsd:circleprogress:1.2.1'
compile 'com.github.smart-fun:XmlToJson:1.2.1'
compile 'com.google.guava:guava:22.0-android'
compile project(':storagechooser')
compile project(':awesomevalidation')
compile project(':rangeseekbar')
compile project(':wizardpager')
}

transorm exception with rx-java duplicate entry

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: rx/Observable$23.class
This is the build.gradle file.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionName "1.1"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
// Enable Java 7 features (diamond operator, string switch statements, etc.)
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
apt 'com.google.dagger:dagger-compiler:2.0'
compile 'com.google.dagger:dagger:2.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.google.code.gson:gson:2.3'
compile 'com.squareup:otto:1.3.6'
compile 'com.github.frankiesardo:icepick:2.3.6'
provided 'com.github.frankiesardo:icepick-processor:2.3.6'
compile 'com.squareup.retrofit:retrofit:1.6.1'
compile 'org.parceler:parceler:0.2.9'
compile 'com.netflix.rxjava:rxjava-android:0.20.7'
provided 'org.glassfish:javax.annotation:10.0-b28'
compile 'com.jakewharton:butterknife:5.1.2'
compile 'io.reactivex:rxjava-computation-expressions:0.21.0'
}
Problem
compile 'com.netflix.rxjava:rxjava-android:0.20.7' //Problem Here
compile 'io.reactivex:rxjava-computation-expressions:0.21.0'
Call io.reactivex instead of com.netflix.rxjava
Finally
compile 'io.reactivex.rxjava2:rxjava:2.0.1'
compile 'io.reactivex:rxjava-computation-expressions:0.21.0'
Then Clean-Rebuild & Run .
EDIT
You should use latest stable version
compileSdkVersion 25
buildToolsVersion "25.0.1"
targetSdkVersion 25
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'

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'
}

Android Studio Gradle error “Multiple dex files define…”

My Project was working fine, until I added the volley library. Then, it started giving me an error like this:
Error:Execution failed for task
':app:packageAllDebugClassesForMultiDex'.> java.util.zip.ZipException:
duplicate entry: com/android/volley/AuthFailureError.class
What should I do to fix this error?
My App gradle is below
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.snsepro.mym"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
ext {
supportLibVersion = '23.1.1' // variable that can be referenced to keep support libs consistent
}
repositories {
maven { url 'https://zendesk.artifactoryonline.com/zendesk/repo' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/gcm.jar')
compile files('libs/gcm-src.jar')
compile files('libs/picasso-2.5.2.jar')
compile files('libs/jsoup-1.7.3.jar')
compile files('libs/gson-2.2.4.jar')
compile files('libs/volley.jar')
compile files('libs/cometchat-sdk.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.prolificinteractive:material-calendarview:0.7.0'
compile 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.2.9#aar'
compile 'com.github.siyamed:android-shape-imageview:0.9.+#aar'
compile 'com.balysv:material-ripple:1.0.2'
compile 'com.isseiaoki:simplecropview:1.0.8'
compile 'se.emilsjolander:stickylistheaders:2.7.0'
compile 'com.github.ksoichiro:android-observablescrollview:1.6.0'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile('com.zopim.android:sdk:1.1.1') {
exclude group: 'com.squareup.picasso'
}
}
And here is volley library added bulild.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.snsepro.mym"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
ext {
supportLibVersion = '23.1.1' // variable that can be referenced to keep support libs consistent
}
repositories {
maven { url 'https://zendesk.artifactoryonline.com/zendesk/repo' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/gcm.jar')
compile files('libs/gcm-src.jar')
compile files('libs/picasso-2.5.2.jar')
compile files('libs/jsoup-1.7.3.jar')
compile files('libs/gson-2.2.4.jar')
compile files('libs/volley.jar')
compile files('libs/cometchat-sdk.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.prolificinteractive:material-calendarview:0.7.0'
compile 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.2.9#aar'
compile 'com.github.siyamed:android-shape-imageview:0.9.+#aar'
compile 'com.balysv:material-ripple:1.0.2'
compile 'com.isseiaoki:simplecropview:1.0.8'
compile 'se.emilsjolander:stickylistheaders:2.7.0'
compile 'com.github.ksoichiro:android-observablescrollview:1.6.0'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile('com.zopim.android:sdk:1.1.1') {
exclude group: 'com.squareup.picasso'
}
compile 'com.mcxiaoke.volley:library-aar:1.0.1'
}
What library is your compile files('libs/volley.jar') If it is the same one , you will definitely get this error. Try removing either one in that case.

Categories

Resources