I am trying to deploy signed apk from android studio. I have configured the build.gradle with required credentials but I've got some warnings when I try to build the .apk. I tried adding some commands in proguard rules but still I get same warnings. How can I fix this issue?
Here are the pictures of the issue.
And this is the gradles file.
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'com.neenbedankt.android-apt'
//apply plugin: 'com.google.gms.google-services'
android {
signingConfigs {
release {
keyAlias 'something'
keyPassword 'something'
storeFile file('D:/something')
storePassword 'something'
}
}
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.aam.skillschool"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
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.google.apis:google-api-services-youtube:v3-rev179-1.22.0'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.jakewharton:butterknife:8.4.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.jakewharton.timber:timber:4.3.1'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.google.code.gson:gson:2.8.0'
testCompile 'junit:junit:4.12'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
apt 'com.google.dagger:dagger-compiler:2.7'
compile 'com.google.dagger:dagger:2.7'
provided 'javax.annotation:jsr250-api:1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'br.com.mauker.materialsearchview:materialsearchview:1.2.0'
compile 'com.google.http-client:google-http-client-android:+'
compile 'com.google.api-client:google-api-client-android:+'
compile 'com.google.api-client:google-api-client-gson:+'
}
Thanks in advance!
you have the non-use classes of your imported libraries already deleted by proguard, revert back to the version where u had no pro-guard applied,that version should work.Then carefully include all your exceptions and rules of all your libraries in your pro-guard rules and then try to use the proguard
Related
I added a few dependencies in my project and when I run it this error shows:
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. > java.io.IOException: Can't write [D:\android\projects\android-client\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [D:\android\projects\android-client\app\build\intermediates\transforms\desugar\debug\47.jar(;;;;;;**.class)] (Duplicate zip entry [47.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))
and here is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.arizeh.arizeh"
minSdkVersion 17
targetSdkVersion 22
multiDexEnabled true
versionCode 31
versionName "3.0.5"
useLibrary 'org.apache.http.legacy'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [manifestApplicationId : "",
onesignal_app_id : "",
onesignal_google_project_number: ""]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
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:appcompat-v7:26.0.0-beta1'
compile 'com.google.android.gms:play-services-plus:15.0.1'
compile 'com.google.android.gms:play-services-analytics:15.0.2'
compile 'com.google.android.gms:play-services-nearby:15.0.1'
compile 'com.google.android.gms:play-services-maps:15.0.1'
compile 'com.google.android.gms:play-services-places:15.0.1'
compile 'com.google.android.gms:play-services-location:15.0.1'
compile 'com.google.android.gms:play-services-gcm:15.0.1'
compile 'com.google.android.gms:play-services-base:15.0.1'
compile 'com.google.firebase:firebase-messaging:15.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.koushikdutta.ion:ion:2.+'
compile 'com.android.support:percent:26.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.shawnlin:number-picker:2.4.2'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.android.support:multidex:1.0.3'
compile 'com.android.support:support-compat:26.1.0'
compile 'com.daimajia.easing:library:2.0#aar'
compile 'com.daimajia.androidanimations:library:2.2#aar'
compile 'com.zarinpal:purchase:0.0.3-beta'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile "com.android.support:support-core-ui:26.4.0"
implementation 'com.rahnema.vas3gapi:vas3g-api:2.0.0'
}
apply plugin: 'com.google.gms.google-services'
You need to use the same version of support library. In your dependencies block, you adding multiple version of support libraries:
compile 'com.android.support:appcompat-v7:26.0.0-beta1'
compile 'com.android.support:design:26.1.0'
compile "com.android.support:support-core-ui:26.4.0"
use only one version either 26.1.0 or 26.4.0. Don't use beta version.
I think you have not added the dependency.
dependencies {
compile 'com.android.support:multidex:1.0.3'
}
please add it and rebuild the project.I hope it will be work
The Problem occur when i generate release version of the APK . I have already view this question and try all things mention but problem still exists Please point me in the right direction
Error
Error:Execution failed for
task:app:transformClassesWithJarMergingForRelease'.
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
android/support/design/widget/CoordinatorLayout$1.class
gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "com.example.wildstone.cv_maker"
minSdkVersion 19
versionCode 1
versionName "1.0"
targetSdkVersion 27
multiDexEnabled true //important
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
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:27.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.itextpdf:itextg:5.5.10'
testCompile 'junit:junit:4.12'
}
This generally happens when you are using different versions of SDK and support libraries.
Replace the versions of these
compile 'com.android.support:cardview-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
to
compile 'com.android.support:cardview-v7:27.1.0'
compile 'com.android.support:design:27.1.0'
and it should work.
Error:No such property: defaultConfig for class: java.lang.String
I am getting this error as soon as i sync my project but the same project is working fine in other people's computer.
i can not find the problem please help me fix this.
here is the build.gradle
apply plugin: 'com.android.application'
android {
android.defaultConfig.vectorDrawables.setUseSupportLibrary(true)
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries false
}
compileSdkVersion 26
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.Aven.andromedia"
minSdkVersion 15
targetSdkVersion 26
versionCode 3
versionName "1.0"
testInstrumentationRunner"android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
vectorDrawables {
useSupportLibrary = true
}
}
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'
})
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.aurelhubert:ahbottomnavigation:2.1.0'
compile 'com.android.support:support-vector-drawable:26.1.0'
compile 'devlight.io:navigationtabbar:1.2.5'
compile 'com.android.support:support-v4:26.3.1'
compile 'com.leo.simplearcloader:simplearcloader:1.0.+'
compile 'com.github.jd-alexander:LikeButton:0.2.3'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp3:okhttp:3.7.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2'
compile 'com.jakewharton.timber:timber:3.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.google.android.gms:play-services-auth:11.8.0'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.firebase:firebase-ads:11.8.0'
compile 'com.github.vivchar:ViewPagerIndicator:v1.0.1'
compile 'com.github.GrenderG:Toasty:1.2.5'
compile 'com.anjlab.android.iab.v3:library:1.0.44'
compile 'com.yayandroid:ParallaxRecyclerView:1.1'
compile 'com.facebook.android:facebook-android-sdk:4.29.0'
compile 'pl.bclogic:pulsator4droid:1.0.3'
compile 'com.jaredrummler:animated-svg-view:1.0.5'
compile 'com.miguelcatalan:materialsearchview:1.4.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
May I ask which gradle version you are running?
If the error occured after updating to gradle 3.0 you might wanna check out the Gradle 3.0 migration guide for help.
You should remove line android.defaultConfig.vectorDrawables.setUseSupportLibrary(true)
Hi am facing the following error in Android Studio ..
Error:Execution failed for task
':app:transformClassesWithJarMergingForFlavorDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
com/google/zxing/aztec/AztecDetectorResult.class
Project was working fine but I dont know why it start giving this exception .. I did not changed anything in gradle file..
gradle File:
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'Project'
keyPassword 'password'
storeFile file('./../project/project.keystore')
storePassword 'password'
}
}
compileSdkVersion 25
buildToolsVersion '25.0.2'
useLibrary 'org.apache.http.legacy'
lintOptions {
checkReleaseBuilds false
}
dexOptions {
jumboMode = true
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "com.project.project"
minSdkVersion 15
targetSdkVersion 25
versionCode 38
versionName "2.1.0"
multiDexEnabled true
signingConfig signingConfigs.config
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
debug {
signingConfig signingConfigs.config
}
}
productFlavors {
flavor {
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/AndroidSwipeLayout-v1.1.8.jar')
compile files('libs/commons-codec-1.3.jar')
compile files('libs/httpmime-4.3.5.jar')
compile files('libs/linkedin-j-android.jar')
compile files('libs/localytics.jar')
compile files('libs/picasso-2.5.2.jar')
compile files('libs/retrofit-1.9.0.jar')
compile files('libs/twitter4j-core-4.0.1.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/zxing-2.1.jar')
compile files('libs/bolts-android-1.1.2.jar')
compile('com.facebook.android:facebook-android-sdk:[4,5)') {
exclude module: 'bolts-android'
exclude module: 'com.android.support:support-v4:23.0.3'
}
// compile 'com.kbeanie:image-chooser-library:1.6.0#aar'
// compile 'com.kbeanie:image-chooser-library:1.5.8#aar'
compile files('libs/isoparser-1.0-RC-27.jar')
compile files('libs/aspectjrt-1.8.7.jar')
compile project(':image-chooser-library')
compile 'com.google.code.gson:gson:2.7'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
compile 'com.google.android.gms:play-services-gcm:10.2.1'
compile 'com.google.android.gms:play-services-plus:10.2.1'
compile 'com.appsflyer:af-android-sdk:4.+#aar'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'javax.media:jmf:2.1.1e'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
I am using;
Windows 8.1 pro,
Android Studio 2.3.3
What i Tried till now;
Clean Build Rebuild
gradlew clean
Delete Both build folders
Nothing worked
Can please someone help me .. if any other information required please let me know
Updated Information:
Working on emulators without changing anything but not on my handset even it was working on it aswell
Try to add this to your app's build.gradle dependencies:
compile('com.google.zxing:core:2.1') {
exclude group: 'com.google.zxing'
}
and remove this line:
compile files('libs/zxing-2.1.jar')
If you are not using flavours then just remove the flavour section in gradle
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'Project'
keyPassword 'password'
storeFile file('./../project/project.keystore')
storePassword 'password'
}
}
compileSdkVersion 25
buildToolsVersion '25.0.2'
useLibrary 'org.apache.http.legacy'
lintOptions {
checkReleaseBuilds false
}
dexOptions {
jumboMode = true
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "com.project.project"
minSdkVersion 15
targetSdkVersion 25
versionCode 38
versionName "2.1.0"
multiDexEnabled true
signingConfig signingConfigs.config
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
debug {
signingConfig signingConfigs.config
}
}
// comenting the flavour section
// productFlavors {
// flavor {
// }
// }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/AndroidSwipeLayout-v1.1.8.jar')
compile files('libs/commons-codec-1.3.jar')
compile files('libs/httpmime-4.3.5.jar')
compile files('libs/linkedin-j-android.jar')
compile files('libs/localytics.jar')
compile files('libs/picasso-2.5.2.jar')
compile files('libs/retrofit-1.9.0.jar')
compile files('libs/twitter4j-core-4.0.1.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/zxing-2.1.jar')
compile files('libs/bolts-android-1.1.2.jar')
compile('com.facebook.android:facebook-android-sdk:[4,5)') {
exclude module: 'bolts-android'
exclude module: 'com.android.support:support-v4:23.0.3'
}
// compile 'com.kbeanie:image-chooser-library:1.6.0#aar'
// compile 'com.kbeanie:image-chooser-library:1.5.8#aar'
compile files('libs/isoparser-1.0-RC-27.jar')
compile files('libs/aspectjrt-1.8.7.jar')
compile project(':image-chooser-library')
compile 'com.google.code.gson:gson:2.7'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
compile 'com.google.android.gms:play-services-gcm:10.2.1'
compile 'com.google.android.gms:play-services-plus:10.2.1'
compile 'com.appsflyer:af-android-sdk:4.+#aar'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'javax.media:jmf:2.1.1e'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
I'm trying to send a file to my Datastore of google. When I try to run the application I take the following error:
Error:Execution failed for task
':app:transformResourcesWithMergeJavaResForDebug'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files
copied in APK
com/google/appengine/repackaged/org/apache/commons/codec/language/bm/sep_approx_spanish.txt
File1:
C:\Users\Javier.gradle\caches\modules-2\files-2.1\com.google.appengine\appengine-endpoints\1.9.28\bf2e8a74bd28e388b3487fc78a0c7adfa592fd5d\appengine-endpoints-1.9.28.jar
File2:
C:\Users\Javier.gradle\caches\modules-2\files-2.1\com.google.appengine\appengine-api-1.0-sdk\1.9.34\7c15c22fd362478e9758081d28e51590304d5ff4\appengine-api-1.0-sdk-1.9.34.jar
I tried exclude the file with
packagingOptions {
exclude 'sep_approx_spanish.txt'
}
but it doesn't work. My Build.gradle is the next:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.example.javier.wh"
minSdkVersion 23
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'sep_approx_spanish.txt'
}
}
dependencies {
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.0.1'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.google.code.findbugs:jsr305:2.0.1'
testCompile 'junit:junit:4.12'
compile project(path: ':backend', configuration: 'android-endpoints')
compile 'com.google.appengine:appengine-api-1.0-sdk:1.9.34'
compile 'com.google.appengine:appengine-endpoints:1.9.28'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.28'
compile 'javax.servlet:servlet-api:2.5'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.guava:guava:19.0'
compile 'com.googlecode.objectify:objectify:5.1.12'
}
Someone had the same problem?
Help please!
Put below line in your app build.gradle inside android block
packagingOptions {
pickFirst 'com/google/appengine/repackaged/org/apache/commons/codec/language/bm/sep_approx_spanish.txt'
}