- Build from command line (use ant)
- Create build.xml
- For old sdk (such 1.5)
activitycreator --out - For new sdk
android update project -t -p
Notes: you can run 'android list target' list all supported targets. the relationship among sdk version, api level, and target are:
SDK Ver API Level Target
1.5 3 1
1.6 4 2
2.1 7 3
2.2 8 4
- xxx
- Build
Run 'ant [debug|release]' on command line to start build.
- xxx
- Proguard
- Intro
The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. - Docs
- http://developer.android.com/guide/developing/tools/proguard.html
- Command
- keep
- What need to be kept
All classes name and methodes that will be accessed out of application need to be kept, such as:
- Native methods
- The class name and methods that are referenced in JNI
- The constructor of classes that will be initiated by System
- What need NOT to be kept
- Methods inherit from classes defined in SDK
- private method/fields
- the methods/files that are only used with in app
- xxx
- keepattributes
- InnerClasses
Preserve the name of inner class, so that the inner class be referenced outside of outer class. By default, the name of inner class is OuterClass$InnerClass, while if this attribute is present, the name of inner class becomes InnerClass.
- xxx
- xxx
- FAQ
- [Question] Class members to be accessed in JNI are removed after optimized by ProGuard even if you added the following lines:
-keep
[Solution] Modify the line as following:
-keep {
;
}
i.e. if you want to prevent helloworld.output from being removed, you need to add the following lines:
-keep class com.helloworld {
public void output(int, java.lang.String);
}
- Issue
- java.lang.NoClassDefFoundError
- Reverse .apk
Please refer to: http://blogold.chinaunix.net/u/9577/showart.php?id=2260443
- Check the reversed source code to see which classes and/or their methods should be preserved but actually they are obfuscated. To resolve this issue, just keep corresponding classes name and/or methods name.
- Unknown Source
App crashes on launch when built with Proguard 4.3 due to verify errors
- xxx
- xxx
- xxx
阅读(1179) | 评论(0) | 转发(0) |