Reputation: 2882
When I activate proguard I can't generate my projet :
http://www.pastefile.com/hyEvNK
My build file is :
apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.sh.inv" targetSdkVersion 23 versionCode 66 versionName "2.5.0" multiDexEnabled false } buildTypes { release { minifyEnabled true proguardFiles 'proguard-project.txt' } } productFlavors { } productFlavors { minSdkVersion 21 } } repositories { maven { url "http://jzaccone.github.io/SlidingMenu-aar" } } dependencies { compile files('libs/ormlite-android-4.48.jar') compile files('libs/ormlite-core-4.48.jar') compile 'com.android.support:multidex:1.0.1' compile 'com.android.support:appcompat-v7:23.2.1' compile 'com.android.support:support-v4:23.2.1' compile 'com.android.support:support-v13:23.2.1' compile 'com.google.code.gson:gson:2.6.2' compile 'org.apache.httpcomponents:httpcore:4.4.4' compile 'com.android.support:design:23.2.1' compile 'com.android.support:preference-v14:23.2.1' compile 'com.google.android.gms:play-services-analytics:8.4.0' compile 'com.google.android.gms:play-services-identity:8.4.0' compile 'com.google.android.gms:play-services-drive:8.4.0' compile 'org.apache.commons:commons-io:+' compile project(':afilechooser') compile project(':simplecropimage') } configurations { compile.exclude group: "org.apache.httpcomponents", module: "httpclient" }
and the proguard-project.txt is :
-dontwarn android.support.** -dontwarn com.google.gson.** -dontwarn com.j256.** -dontwarn com.actionbarsherlock.** -assumenosideeffects class android.util.Log { public static *** d(...); public static *** v(...); } -keep class com.j256.** -keepclassmembers class com.j256.** {*;} -keep enum com.j256.** -keepclassmembers enum com.j256.** {*;} -keep interface com.j256.** -keepclassmembers interface com.j256.** {*;} -keep interface android.support.** -keepclassmembers interface android.support.** {*;} -keep interface com.mapsaurus.paneslayout.** -keepclassmembers interface com.mapsaurus.paneslayout.** {*;} -keep class com.sh.inv.businessobjects.* -keepclassmembers class com.sh.inv.businessobjects.* { *; } -keep class com.sh.inv.DatabaseHelper -keepclassmembers class com.sh.inv.inv.DatabaseHelper { *; } -keep class com.sh.inv.businessobjects.ws.* -keepclassmembers class com.sh.inv.businessobjects.ws.* { *; } -keep class com.android.vending.billing.* -keepclassmembers class com.android.vending.billing.* { *; } -keep class com.sh.inv.ui.fragment.* -keepclassmembers class com.sh.inv.ui.fragment.* { *; } -keepclassmembers class * { public (android.content.Context); } -keepattributes Signature -keepattributes Annotation -renamesourcefileattribute SourceFile -keepattributes SourceFile,LineNumberTable -keep public class * extends android.app.Fragment -keep public class * extends android.support.v4.app.DialogFragment -keep public class * extends com.sh.inv.ui.common.FragmentActivityBase -keepclassmembers class * extends com.actionbarsherlock.ActionBarSherlock { (android.app.Activity, int); } #-injars libs -keep class * extends java.util.ListResourceBundle { protected Object[][] getContents(); } -keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable { public static final *** NULL; } -keepnames @com.google.android.gms.common.annotation.KeepName class * -keepclassmembernames class * { @com.google.android.gms.common.annotation.KeepName *; } -keepnames class * implements android.os.Parcelable { public static final ** CREATOR; }
it was working in the last version but it was a sleeping project and I had to migrate it from eclipse to android studio and upgrade all references maybe there are some errors in the imported libs ..
Moreover I have a lot of warning I didn't have before about ormlite or duplicate definition of library
Upvotes: 0
Views: 670
Reputation: 2882
tiny sunlight gave me some clues and finally I found the answer
I needed to remove
compile 'org.apache.httpcomponents:httpcore:4.4.4'
in my gradle build config because it is now integrated in the android build tools (I think). I don't know why it works in debug / release mode but not when it is obfuscated with proguard.
Upvotes: 0
Reputation: 6251
add
android {
useLibrary 'org.apache.http.legacy'
lintOptions {
checkReleaseBuilds false
abortOnError false
}
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'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/maven/com.squareup.okio/okio/pom.xml'
exclude 'META-INF/maven/com.squareup.okio/okio/pom.properties'
}
}
Upvotes: 0