Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2026127
  • 博文数量: 413
  • 博客积分: 10926
  • 博客等级: 上将
  • 技术积分: 3862
  • 用 户 组: 普通用户
  • 注册时间: 2006-01-09 18:14
文章分类

全部博文(413)

文章存档

2015年(5)

2014年(1)

2013年(5)

2012年(6)

2011年(138)

2010年(85)

2009年(42)

2008年(46)

2007年(26)

2006年(59)

分类:

2010-09-17 13:40:04

  1. Build from command line (use ant)
    • Create build.xml
      1. For old sdk (such 1.5)
        activitycreator --out
      2. 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
      3. xxx
    • Build
      Run 'ant [debug|release]' on command line to start build.
    • xxx
  2. Proguard
    1. Intro
      The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. 
    2. Docs
      • http://developer.android.com/guide/developing/tools/proguard.html

    3. Command
      • keep
        1. 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
        2. 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
        3. xxx
      • keepattributes
        1. 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.
        2. xxx
      • xxx
    4. 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);
        }
    5. Issue
      • java.lang.NoClassDefFoundError
        1. Reverse .apk
          Please refer to: http://blogold.chinaunix.net/u/9577/showart.php?id=2260443
        2. 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
    6. xxx
  3. xxx
阅读(1138) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~