2

I have some problems on proguard optimization.

I have following build.gradle snippet.

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

And the corresponding proguard-rules.pro.

-dontskipnonpubliclibraryclasses
-dontobfuscate
-forceprocessing
-optimizationpasses 5
-optimizations !class/unboxing/enum

-keep class * extends android.app.Activity
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
public static *** i(...);
public static *** w(...);
public static *** e(...);
public static *** wtf(...);
}

-keep public class com.google.android.gms.ads.** {
public *;
}

-keep public class com.google.android.gms.maps.** {
public *;
}

-keep public class com.google.ads.** {public *;}

-keep public class com.google.android.gms.* { public *; }
-keep public class com.google.android.gms.ads.* { public *; }
-dontwarn com.google.android.gms.**

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

There is no problem if proguard-android.txt is used instead of proguard-android-optimize.txt To modify proguard-rules.pro, I have already added any modification that I can find. But the following error keep happening. Please help. Thank you.

:app:dexTrialRelease
EXCEPTION FROM SIMULATION:
local variable type mismatch: attempt to set or access a value of type java.lang.Object using a local variable of type int. This is symptomatic of .class transformation tools that ignore local variable information.
...at bytecode offset 000000e6
locals[0000]: Lcom/google/android/gms/maps/model/internal/zzf$zza;
locals[0001]: I
locals[0002]: Landroid/os/Parcel;
locals[0003]: Landroid/os/Parcel;
locals[0004]: I
stack[top0]: Ljava/lang/String;
...while working on block 00e6
...while working on method onTransact:(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
...while processing onTransact (ILandroid/os/Parcel;Landroid/os/Parcel;I)Z
...while processing com/google/android/gms/maps/model/internal/zzf$zza.class
1 error; aborting
WeiHung
  • 109
  • 2
  • 10
  • I found a solution from [link](http://stackoverflow.com/questions/5701126/compile-with-proguard-gives-exception-local-variable-type-mismatch)_italic_ **bold** 'plowman'. It ends that I need to remove -dontobfuscate. – WeiHung Jun 24 '15 at 00:48
  • Sorry for not familiar with stackoverflow editing. [Here is the correct link](http://stackoverflow.com/questions/5701126/compile-with-proguard-gives-exception-local-variable-type-mismatch#7587680) – WeiHung Jun 24 '15 at 01:00

0 Answers0