开发者

Android ProGuard settings to use with app that uses licensing server to not force close?

开发者 https://www.devze.com 2023-01-18 05:49 出处:网络
I\'ve seemingly tried every setting in various articles on the internet including excluding all of my classes through -keep public class.

I've seemingly tried every setting in various articles on the internet including excluding all of my classes through -keep public class.

What settings should be used to not force close? At this point if I could get obfuscation with nothing else would be fine.

Below are sample configurations I've tried and my app开发者_JS百科 still force closes. Any ideas?

I followed this article as well as others: http://android-developers.blogspot.com/2010/09/proguard-android-and-licensing-server.html

Still no luck. Any help would be appreciated. Thanks

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-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 com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
    native ;
}

-keepclasseswithmembernames class * {
    public (android.content.Context, android.util.AttributeSet); 
}

-keepclasseswithmembernames class * {
    public (android.content.Context, android.util.AttributeSet, int); 
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

Similar options:

-target 1.6 
-optimizationpasses 5 
-allowaccessmodification 
-dontusemixedcaseclassnames 
-dontskipnonpubliclibraryclasses 
-dontpreverify 
-verbose 
-dump class_files.txt 
-printseeds seeds.txt 
-printusage unused.txt 
-printmapping mapping.txt 

# The -optimizations option disables some arithmetic
# simplifications that Dalvik 1.0 and 1.5 can't handle. 

-optimizations !code/simplification/arithmetic 

-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 View { 
public (android.content.Context); 
public (android.content.Context, android.util.AttributeSet); 
public (android.content.Context, android.util.AttributeSet, int); 
public void set*(...); 
} 

-keep public class com.android.vending.licensing.ILicensingService

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}


-keep interface com.android.vending.licensing.*
-keep public interface com.android.vending.licensing.ILicenseResultListener
-keep public interface com.android.vending.licensing.ILicensingService
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
} 


Just comment this line in the proguard.cfg file and clean/rebuild your project:

#-keep public class com.android.vending.licensing.ILicensingService


Delete all compiled classes in the classes directory and rebuild was the answer. Something was obviously corrupt. Once I did that, it just worked!

0

精彩评论

暂无评论...
验证码 换一张
取 消