2

I am installing app through studio I guess that's instant run

I guess my code is not shrinking since my apk is still 16.1 MB large and nothing in it except sinch library..

buildTypes {    
        release {
            shrinkResources true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
        }
}

Don't know if I have to add this in instant run or not.....

debug {
        minifyEnabled true
        useProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
                'proguard-rules.pro'
 }

but when use debug it shows this :

Gradle build process failed with "Error:Execution failed for task ':app:transformClassesWithNewClassShrinkerForDebug'. > Warnings found during shrinking, please use -dontwarn or -ignorewarnings to suppress them." - Proguard #206

Don't know if my app is in release mode if it is not in release mode then I guess I will receive same error when I am in release mode but if this is a problem of debugger and I am already in release mode then why my app isn't shrinking?

Please help!

D.J
  • 1,439
  • 1
  • 12
  • 23
SamH67
  • 319
  • 1
  • 4
  • 14

1 Answers1

0

As stated in the error message you should use -dontwarn in your proguard-rules.pro file in your app module

Example:

-dontwarn javax.management.**
-dontwarn java.lang.management.**
-dontwarn org.json.JSONObject
-dontwarn org.apache.commons.codec.binary.Base64
-dontwarn org.apache.commons.logging.LogFactory
-dontwarn org.apache.log4j.Logger
-dontwarn org.apache.log4j.Level
-dontwarn org.slf4j.LoggerFactory
-dontwarn org.slf4j.Logger
-dontwarn org.slf4j.impl.StaticMDCBinder
-dontwarn org.slf4j.impl.StaticMarkerBinder
-dontwarn org.apache.http.entity.mime.content.FileBody
-dontwarn org.apache.http.entity.mime.MultipartEntity
-dontwarn org.apache.http.entity.mime.FormBodyPart
-dontwarn org.apache.http.entity.mime.MinimalField
-dontwarn org.apache.http.entity.mime.HttpMultipart
-dontwarn org.apache.http.entity.mime.content.AbstractContentBody
-dontwarn org.apache.http.entity.mime.content.StringBody
-dontwarn org.apache.http.entity.mime.content.InputStreamBody
-dontwarn org.apache.http.entity.mime.MIME
-dontwarn android.support.v4**
-dontwarn com.google.**

Google what you should suppress for libraries you use in your project,

good luck

Belzebub
  • 944
  • 1
  • 9
  • 20
  • But I have jniLibs which is quite large and it has 4 folders armeabi-v7a, arm64-v8a, x86 and x86_64 since I am using sinch only for app-app calling I guess it is including all functiionlity for app-phone calling,messaging,etc which sinch provided in its sdk don't know how to exclude those..... – SamH67 Jan 11 '17 at 09:23
  • I found this in sinch proguard txt -keepclasseswithmembernames class * { native ; } – SamH67 Jan 11 '17 at 09:24
  • and you have seen that I am minifying only in release so if I run this app from studio install it on my mobile share it with other mobile using shareIT and see the apk size what would it be? will it be reduced or not ? remember I am using shrinker and minify in release – SamH67 Jan 11 '17 at 09:32
  • Not working it was 16.1 MB before and 16.1 MB after sorry man – SamH67 Jan 11 '17 at 09:46
  • you used minifyEnabled = true in debug mode also, so your app should be shrinking or giving the same error message in debug mode also, if that doesn't happen make sure run execute AssembleDebug gradle command and nothing else, that way it should be easier to see whats wrong with proguard rules – Belzebub Jan 11 '17 at 10:21
  • Okay I have to do using command line by going into the project directory ....I'll inform you with the the problem – SamH67 Jan 11 '17 at 10:48