Today in the use of Proguard keep a static internal class, the confusion has been unable to find the static internal class, the heart crazy AH.
Finally found the answer on the StackOverflow:
-keepattributes exceptions,innerclasses,...
-keep class [PackageName]. a{
*;
}
-keep class [PackageName]. a$* {
*;
}
Where a$* indicates that all A's internal classes are preserved or can be used as follows:
-keepattributes exceptions,innerclasses,..
, Broadcastreceiver, Custom views such as ContentProvider, Fragment, Context, LinearLayout, view, and so on.2. Keep Some of the content that comes with the SDK system.-keepattributes exceptions,innerclasses,signature,deprecated,sourcefile,linenumbertable,*annotation*, EnclosingmethodFor example,-keepattributes *annotation* will retain the activity's @override annotated method OnCreate, OnDestroy method, and so on.3. Resource class variables need to be preserved-keepclassmembers class * *. r$* {p
Proguard is a cool obfuscator and shrinking tool (shrinker, please let me know if you have a better translation method ). In addition to obfuscation and protection of your code, it can also automatically detect and delete unused classes, methods, and data members, and remove the package hierarchy, minimize your jar package.Another notable significance of using proguard is that it can automatically delete un
Because Android code is mostly Java code, it is easy to decompile, fortunately, Android ADT for us to integrate the tool of confusing code, one can confuse our code, so that the program is anti-compilation after the basic understanding, but also can play the role of code optimization. Currently, it is recommended to turn on the code obfuscation feature of Android.Android ADT mainly through the Proguard tool to provide code confusion, there are quite a
One, ordinary Android project code confusion (the project does not contain a third-party class library)Step 1: In the project.properties file, remove the following comment: proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt Second, for the ArcGIS for Android project to be confused, because of the use of ArcGIS third-party class library, the project will need to be confu
Have not understood the specific role of some files in the development of Android, and later used, the specific study, a reference to the information on the Internet, the final summary, easy to view later!The old version of a file default.properties, since it is the old version, has been eliminated, no longer delve into.While the new version of ADT creates the project, the mixed-code files are project.properties and proguard-project.txt.If you need to
I. What have code obfuscation been done?1. code obfuscation is usually used to remove unnecessary Code. It is used to rename classes, attributes, and methods with obscure names to reduce the size of the Code, increase the difficulty of decompilation. (If our applications are charged or kept confidential, we need to improve the security of our code through code obfuscation)2. Enable ProGuard in Eclipse1. Check whether the
PrefaceThis chapter describes the developer Guide/Developing/Tools/ProGuard. This chapter describes the obfuscators and version Android3.0 r1 ", welcome to talk with him: "litaojun@gmail.com", thank you again "Jim "! We look forward to your participation in translation of Android related information, contact me over140@gmail.com.
Original
Http://developer.android.com/guide/developing/tools/proguard.html
Obfuscators(
After the Android 2.3 SDK is released, Google has added proguard to Android SDK tools. proguard is a pair. java files are obfuscated with code to a certain extent. It is very convenient to use proguard. If there are no other external jar packages in your project. in the properties file, add a line:
Proguard. Config =
Proguard
Introduction
ProguardIsSourceForgeOn a well-known open-source project. Official Website:Http://proguard.sourceforge.net/.
JavaThe bytecode is generally very easy to decompile. For good protectionJavaSource code, We often compileClassFile for obfuscation.ProguardThe main function is obfuscation. Of course, it can also reduce the size and optimize the bytecode, but those are secondary features for us.
ReferenceProguardThe official introd
One Week summaryThis is the first time to re-csdn and combine to write the summary, looking forward to a good start and further promotion.Last weekSwitch to Androidstudio to work for a period of time, at present, I feel that there are two of places to do enough
1. Often see Gradle code, but do not do a detailed and comprehensive understanding;2. The use of Proguard to confuse knowledge has not done a comprehensive understanding;
The last week
Project (and Android Studio)Configuring in Build.gradleandroid {buildtypes {release {Runproguard true Proguardfi Les Getdefaultproguardfile (' proguard-android.txt '), ' some-other-rules.txt '//proguardfile ' some-other-rules.txt ' Configure a single file So}}} As seen in the code above, we are able to use runproguard true to turn on, and configure it with a confusing configuration to be able to configure multiple files or individual files.The And
Proguard obfuscator running process (other processes are not discussed at the moment): run the proguard script in the command line and directly add parameters and call proguard. CFG, while eclipse ADT releases releaseThis process is executed during APK, and most of the work is completed. It includes parameters specified for injars, outjars, and libraryjars (the j
ProGuard is what it is and what it is used for. It is not introduced here. For details, refer to ProGuard introduction. Here we only mention the following points of attention when using ProGuard:
1. Pay attention to the version. If it is not required by the project, it is best to use the latest stable version. This will reduce the chance of errors and significant
Tags: Android Io OS AR: using a Java file on Art
Encryption is required if your application is to be installed on googleplay. The android SDK has integrated proguard. Therefore, the entire process is much easier.
Add a line of proguard. Config = proguard. cfg to the project. properties file under proj. Android.
Then copy the {Android-SDK-root} \ tools \
Proguard (http://proguard.sourceforge.net/) can be reduced, optimized, and confused with jar files. The reduced JAR file synthesizes multiple input jar files (Injar parameters) into an output jar file (Outjar parameter). Optimized execution is similar to compiler optimizations. The basic obfuscation replaces the variable name, method name, and so on with a shorter alias. This uses the first feature (reduction) of
Some time ago, I was looking at a protected project using proguard.Program, Found the role of proguard:
1) The confusion class name is changed to a. A. X.
2) obfuscated the function name
3) obfuscated strings
ViewCodeAnnoying. In addition, if JD-Gui is used for decompilation, errors may occur.
However, proguard has many disadvantages, such
String test = "winsunxu ";
After progurd protection, i
The previous article said the approximate process and the effect we want to achieve. This article is mainly about the detailed configuration.In fact, just once, it feels very simple. Only two files need to be configured.Pom.xml and ${project.artifactid}-maven.pro These two files can be. Where the Pom.xml configuration plugin is used, the true optimization option is configured in the ${project.artifactid}-maven.pro file.Let's take a look at the complete pom.xml.Three plugins are configured in Pom
the specified class and class member. If all specified class members are present (after the compression step )]
Native }
-Keepclasseswithmembers class * {[protect the members of the specified class and class, but the condition is that all specified Class and Class Members must exist .]Public }
-Keepclasseswithmembers class *{Public }
-Keepclassmembers class * extends Android. App. Activity {[protect members of a specified class. If this class is protected, it will be better protected]Public voi
When using eclipse to confuse Android programs, proguard is used. In Versions later than android2.2, A proguard is used to create projects. cfg file, which is used to confuse the android program, the method is very simple, in the project. add proguard to the properties file. config = proguard. CFG, you can. Of course,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.