2

我正在尝试在我的项目上启用 proguard,但构建不断失败,我遵循了本教程:

http://android-developers.blogspot.com/2010/09/proguard-android-and-licensing-server.html

玩弄配置但没有运气:(

Buildfile: C:\00\work\workspaces\Mobile\TesApp\build.xml

-set-mode-check:

-set-release-mode:

-release-obfuscation-check:

-setup:
     [echo] Creating output directories if needed...
     [echo] Gathering info for TesApp...
    [setup] Android SDK Tools Revision 19
    [setup] Project Target: Android 4.0.3
    [setup] API level: 15
    [setup] 
    [setup] ------------------
    [setup] Resolving library dependencies:
    [setup] No library dependencies.
    [setup] 
    [setup] ------------------
    [setup] API<=15: Adding annotations.jar to the classpath.
    [setup] 
    [setup] ------------------

-build-setup:

-pre-build:

-code-gen:
     [echo] ----------
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
[renderscript] No RenderScript files to compile.
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Found Deleted Target File
     [aapt] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] No need to generate new BuildConfig.

-pre-compile:

-compile:
    [javac] Compiling 1 source file to C:\00\work\workspaces\Mobile\TesApp\bin\classes

-dex-obfuscate:

-dex-no-obfuscate:

-post-compile:

-obfuscate:
   [delete] Deleting: C:\00\work\workspaces\Mobile\TesApp\obf\original.jar
   [delete] Deleting: C:\00\work\workspaces\Mobile\TesApp\obf\obfuscated.jar
      [jar] Building jar: C:\00\work\workspaces\Mobile\TesApp\obf\original.jar
 [proguard] ProGuard, version 4.7
 [proguard] Reading input...
 [proguard] Reading program jar [C:\00\work\workspaces\Mobile\TesApp\obf\original.jar]
 [proguard] Reading program jar [C:\android-sdk-windows\tools\support\annotations.jar]
 [proguard] Reading library jar [C:\android-sdk-windows\platforms\android-15\android.jar]
 [proguard] Initializing...
 [proguard] Ignoring unused library classes...
 [proguard]   Original number of library classes: 3145
 [proguard]   Final number of library classes:    337
 [proguard] Printing kept classes, fields, and methods...
 [proguard] Shrinking...
 [proguard] Printing usage to [C:\00\work\workspaces\Mobile\TesApp\obf\usage.txt]...
 [proguard] Removing unused program classes and class elements...
 [proguard]   Original number of program classes: 54
 [proguard]   Final number of program classes:    40
 [proguard] Optimizing...
 [proguard]   Number of finalized classes:                 23
 [proguard]   Number of vertically merged classes:         0   (disabled)
 [proguard]   Number of horizontally merged classes:       0   (disabled)
 [proguard]   Number of removed write-only fields:         0   (disabled)
 [proguard]   Number of privatized fields:                 0   (disabled)
 [proguard]   Number of inlined constant fields:           0   (disabled)
 [proguard]   Number of privatized methods:                3
 [proguard]   Number of staticized methods:                1
 [proguard]   Number of finalized methods:                 39
 [proguard]   Number of removed method parameters:         0
 [proguard]   Number of inlined constant parameters:       1
 [proguard]   Number of inlined constant return values:    0
 [proguard]   Number of inlined short method calls:        2
 [proguard]   Number of inlined unique method calls:       13
 [proguard]   Number of inlined tail recursion calls:      0
 [proguard]   Number of merged code blocks:                0
 [proguard]   Number of variable peephole optimizations:   132
 [proguard]   Number of arithmetic peephole optimizations: 0   (disabled)
 [proguard]   Number of cast peephole optimizations:       0
 [proguard]   Number of field peephole optimizations:      0
 [proguard]   Number of branch peephole optimizations:     26
 [proguard]   Number of string peephole optimizations:     0
 [proguard]   Number of simplified instructions:           6
 [proguard]   Number of removed instructions:              15
 [proguard]   Number of removed local variables:           4
 [proguard]   Number of removed exception blocks:          0
 [proguard]   Number of optimized local variable frames:   50
 [proguard] Shrinking...
 [proguard] Removing unused program classes and class elements...
 [proguard]   Original number of program classes: 40
 [proguard]   Final number of program classes:    40
 [proguard] Optimizing...
 [proguard]   Number of finalized classes:                 0
 [proguard]   Number of vertically merged classes:         0   (disabled)
 [proguard]   Number of horizontally merged classes:       0   (disabled)
 [proguard]   Number of removed write-only fields:         0   (disabled)
 [proguard]   Number of privatized fields:                 0   (disabled)
 [proguard]   Number of inlined constant fields:           0   (disabled)
 [proguard]   Number of privatized methods:                0
 [proguard]   Number of staticized methods:                0
 [proguard]   Number of finalized methods:                 0
 [proguard]   Number of removed method parameters:         1
 [proguard]   Number of inlined constant parameters:       0
 [proguard]   Number of inlined constant return values:    0
 [proguard]   Number of inlined short method calls:        0
 [proguard]   Number of inlined unique method calls:       0
 [proguard]   Number of inlined tail recursion calls:      0
 [proguard]   Number of merged code blocks:                0
 [proguard]   Number of variable peephole optimizations:   3
 [proguard]   Number of arithmetic peephole optimizations: 0   (disabled)
 [proguard]   Number of cast peephole optimizations:       0
 [proguard]   Number of field peephole optimizations:      0
 [proguard]   Number of branch peephole optimizations:     0
 [proguard]   Number of string peephole optimizations:     0
 [proguard]   Number of simplified instructions:           0
 [proguard]   Number of removed instructions:              123
 [proguard]   Number of removed local variables:           0
 [proguard]   Number of removed exception blocks:          0
 [proguard]   Number of optimized local variable frames:   0
 [proguard] Shrinking...
 [proguard] Removing unused program classes and class elements...
 [proguard]   Original number of program classes: 40
 [proguard]   Final number of program classes:    40
 [proguard] Optimizing...
 [proguard]   Number of finalized classes:                 0
 [proguard]   Number of vertically merged classes:         0   (disabled)
 [proguard]   Number of horizontally merged classes:       0   (disabled)
 [proguard]   Number of removed write-only fields:         0   (disabled)
 [proguard]   Number of privatized fields:                 0   (disabled)
 [proguard]   Number of inlined constant fields:           0   (disabled)
 [proguard]   Number of privatized methods:                0
 [proguard]   Number of staticized methods:                0
 [proguard]   Number of finalized methods:                 0
 [proguard]   Number of removed method parameters:         0
 [proguard]   Number of inlined constant parameters:       0
 [proguard]   Number of inlined constant return values:    0
 [proguard]   Number of inlined short method calls:        0
 [proguard]   Number of inlined unique method calls:       0
 [proguard]   Number of inlined tail recursion calls:      0
 [proguard]   Number of merged code blocks:                0
 [proguard]   Number of variable peephole optimizations:   0
 [proguard]   Number of arithmetic peephole optimizations: 0   (disabled)
 [proguard]   Number of cast peephole optimizations:       0
 [proguard]   Number of field peephole optimizations:      0
 [proguard]   Number of branch peephole optimizations:     0
 [proguard]   Number of string peephole optimizations:     0
 [proguard]   Number of simplified instructions:           0
 [proguard]   Number of removed instructions:              5
 [proguard]   Number of removed local variables:           0
 [proguard]   Number of removed exception blocks:          0
 [proguard]   Number of optimized local variable frames:   0
 [proguard] Shrinking...
 [proguard] Removing unused program classes and class elements...
 [proguard]   Original number of program classes: 40
 [proguard]   Final number of program classes:    40
 [proguard] Optimizing...
 [proguard]   Number of finalized classes:                 0
 [proguard]   Number of vertically merged classes:         0   (disabled)
 [proguard]   Number of horizontally merged classes:       0   (disabled)
 [proguard]   Number of removed write-only fields:         0   (disabled)
 [proguard]   Number of privatized fields:                 0   (disabled)
 [proguard]   Number of inlined constant fields:           0   (disabled)
 [proguard]   Number of privatized methods:                0
 [proguard]   Number of staticized methods:                0
 [proguard]   Number of finalized methods:                 0
 [proguard]   Number of removed method parameters:         0
 [proguard]   Number of inlined constant parameters:       0
 [proguard]   Number of inlined constant return values:    0
 [proguard]   Number of inlined short method calls:        0
 [proguard]   Number of inlined unique method calls:       0
 [proguard]   Number of inlined tail recursion calls:      0
 [proguard]   Number of merged code blocks:                0
 [proguard]   Number of variable peephole optimizations:   0
 [proguard]   Number of arithmetic peephole optimizations: 0   (disabled)
 [proguard]   Number of cast peephole optimizations:       0
 [proguard]   Number of field peephole optimizations:      0
 [proguard]   Number of branch peephole optimizations:     0
 [proguard]   Number of string peephole optimizations:     0
 [proguard]   Number of simplified instructions:           0
 [proguard]   Number of removed instructions:              0
 [proguard]   Number of removed local variables:           0
 [proguard]   Number of removed exception blocks:          0
 [proguard]   Number of optimized local variable frames:   0
 [proguard] Obfuscating...
 [proguard] Printing mapping to [C:\00\work\workspaces\Mobile\TesApp\obf\mapping.txt]...
 [proguard] Writing output...
 [proguard] Preparing output jar [C:\00\work\workspaces\Mobile\TesApp\obf\obfuscated.jar]
 [proguard]   Copying resources from program jar [C:\00\work\workspaces\Mobile\TesApp\obf\original.jar]
 [proguard]   Copying resources from program jar [C:\android-sdk-windows\tools\support\annotations.jar]
 [proguard] Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [annotations.jar:META-INF/MANIFEST.MF])
 [proguard] Printing classes to [C:\00\work\workspaces\Mobile\TesApp\obf\dump.txt]...

-dex:
      [dex] Found Deleted Target File
      [dex] Converting compiled files and external libraries into C:\00\work\workspaces\Mobile\TesApp\bin\classes.dex...
       [dx] no classfiles specified

BUILD FAILED
C:\android-sdk-windows\tools\ant\build.xml:818: The following error occurred whi
le executing this line:
C:\android-sdk-windows\tools\ant\build.xml:820: The following error occurred whi
le executing this line:
C:\android-sdk-windows\tools\ant\build.xml:832: The following error occurred whi
le executing this line:
C:\android-sdk-windows\tools\ant\build.xml:278: null returned: 1
4

1 回答 1

0

您可能希望消除您提到的博客文章中建议的优化步骤。

这是因为最近的 ProGuard 改进建议不要这样做。

也尝试使用这里-dontwarn举例说明的指令。

于 2012-06-14T11:49:48.363 回答