Android ProGuard设置与使用许可服务器的应用程序一起使用不强制关闭?

时间:2010-10-02 04:15:24

标签: android

我似乎在互联网上的各种文章中尝试过各种设置,包括通过-keep public class排除我的所有课程。

应该使用哪些设置来强行关闭?在这一点上,如果我可以得到混淆,没有其他任何事情都没关系。

下面是我尝试过的示例配置,我的应用仍然强行关闭。任何想法?
我跟着这篇文章以及其他文章:http://android-developers.blogspot.com/2010/09/proguard-android-and-licensing-server.html

仍然没有运气。任何帮助,将不胜感激。 感谢

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

类似选项:

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

2 个答案:

答案 0 :(得分:5)

只需在proguard.cfg文件中注释这一行并清理/重建项目:

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

答案 1 :(得分:1)

删除classes目录中的所有已编译类,并且重建是答案。有些东西显然是腐败的。一旦我这样做,它就行了!