Reputation: 2657
I am facing this error when I try to build my project using Android Studio
with minifyEnabled true
.
Error's details
:app:transformClassesWithDexForDevDebug
Uncaught translation error: com.android.dx.cf.code.SimException: expected type int but found com.apptimize.hz
Uncaught translation error: com.android.dx.cf.code.SimException: expected type int but found com.apptimize.oa
2 errors; aborting
How can I resolve it?
UPDATE*
Proguard file's content.
-optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontpreverify -verbose -optimizations !code/simplification/arithmetic,!field/,!class/merging/
-dontwarn android.support.** -dontwarn com.atinternet.** -dontwarn org.apache.**
-keep public class * extends android.app.Activity -keep public class * extends android.app.Application -keep public class * extends android.app.Service -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.content.ContentProvider -keep public class * extends android.app.backup.BackupAgentHelper -keep public class * extends android.preference.Preference -keep public class com.android.vending.licensing.ILicensingService
-keepattributes InnerClasses -keepattributes Annotation -keepattributes Signature
-keepclasseswithmembernames class * { native ; }
-keepclasseswithmembers class * { public (android.content.Context, android.util.AttributeSet); }
-keepclasseswithmembers class * { public (android.content.Context, android.util.AttributeSet, int); }
-keepclassmembers class * extends android.app.Activity { public void *(android.view.View); }
-keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); }
-keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; }
-dontwarn java.awt.** -dontwarn CompatHoneycomb -keep class android.support.v4. { *; }
-keep class com.squareup.okhttp.** { *; } -dontwarn uk.co.senab.photoview.** -keep class uk.co.senab.photoview.** { *; }
I used 'com.android.tools.build:gradle:1.5.0'
Is there any problem with my proguard file?
Upvotes: 5
Views: 2445
Reputation: 6520
I was also facing same issue after 3 to 4 days of detailed exploring .Problem arise in gradle version and way of handling dex and classes .
Fix for this can
There are two kind of cases
Case 1 : Since android test cases lots of complication with Mock and Instrumentation test cases.For test cases to pass we have to disable minifyEnabled false which disable progaurd process testCoverageEnabled false .If enbale testCoverageEnabled true which cause this issue .For test cases should be passed the you have to disable progaurd in debug mode and testCoverageEnable false .
debug {
minifyEnabled false
debuggable true
testCoverageEnabled false
proguardFile 'proguard-rules.pro'
}
Case 2: Define testProgurdFile and make minifyEnabled true to proguard in debug mode as wel.
Compile with Proguard gives SimException: "local variable type mismatch" define testProgurdFile as done on below Which will be used for testing in which you can specify the testing progaurd rules one which consumed by testFramework.
debug {
minifyEnabled true
debuggable true
testCoverageEnabled true
proguardFile 'proguard-rules.pro'
testProguardFiles 'test-proguard-rules.pro'
}
Reference links :
Upvotes: 0
Reputation: 1756
See plowman's answer at Compile with Proguard gives SimException: "local variable type mismatch"
Add this to disable a specific optimization that triggers the proguard bug.
-optimizations !code/allocation/variable
worked for me.
Upvotes: 0