使用Proguard DX SimException进行Android构建本地0000:无效

时间:2011-05-28 02:58:57

标签: android exception ant proguard

我正在使用Ant> 1.8 + Proguard 4.6构建我的Android项目,我在构建过程中遇到了异常:

SimException:本地0000:无效

请在下面找到所有构建日志:

Buildfile: build.xml
[setup] Android SDK Tools Revision 11
[setup] Project Target: Android 3.1
[setup] API level: 12
[setup] ------------------
[setup] Resolving library dependencies:
[setup] No library dependencies.
[setup] ------------------
[setup] WARNING: Attribute minSdkVersion in AndroidManifest.xml (4) is lower than the project target API level (12)
-set-release-mode:
-release-obfuscation-check:
-pre-build:
-dirs:
 [echo] Creating output directories if needed...
-aidl:
 [echo] Compiling aidl files into Java classes...
-renderscript:
 [echo] Compiling RenderScript files into Java classes and RenderScript bytecode...
-resource-src:
 [echo] Generating R.java / Manifest.java from the resources...
-pre-compile:
compile:
[javac] build.xml:459: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 3 source files to /bin/classes
-post-compile:
-obfuscate:
[delete] Deleting: /bin/proguard/original.jar
[delete] Deleting: /bin/proguard/obfuscated.jar
  [jar] Building jar: /bin/proguard/original.jar
 [proguard] ProGuard, version 4.6
 [proguard] Reading input...
[proguard] Reading program jar [/bin/proguard/original.jar]
 [proguard] Reading program jar [/libs/lJar.jar]
 [proguard] Reading program jar [/libs/android-support-v4.jar]
 [proguard] Reading program jar [libs/libGoogleAnalytics.jar]
 [proguard] Reading library jar [/platforms/android-12/android.jar]
 [proguard] Initializing...
 [proguard] Note: the configuration refers to the unknown class 'com.android.vending.licensing.ILicensingService'
 [proguard] Note: there were 1 references to unknown classes.
 [proguard]       You should check your configuration for typos.
 [proguard] Ignoring unused library classes...
 [proguard]   Original number of library classes: 3012
 [proguard]   Final number of library classes:    656
 [proguard] Printing kept classes, fields, and methods...
 [proguard] Shrinking...
 [proguard] Printing usage to [/bin/proguard/usage.txt]...
 [proguard] Removing unused program classes and class elements...
 [proguard]   Original number of program classes: 401
 [proguard]   Final number of program classes:    312
 [proguard] Inlining subroutines...
 [proguard] Optimizing...
 [proguard]   Number of finalized classes:                 183
 [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:           631   (disabled)
 [proguard]   Number of privatized methods:                122
     [proguard]   Number of staticized methods:                63
 [proguard]   Number of finalized methods:                 1089
 [proguard]   Number of removed method parameters:         78
 [proguard]   Number of inlined constant parameters:       29
 [proguard]   Number of inlined constant return values:    6
 [proguard]   Number of inlined short method calls:        48
 [proguard]   Number of inlined unique method calls:       147
 [proguard]   Number of inlined tail recursion calls:      3
 [proguard]   Number of merged code blocks:                11
 [proguard]   Number of variable peephole optimizations:   860
 [proguard]   Number of arithmetic peephole optimizations: 0   (disabled)
 [proguard]   Number of cast peephole optimizations:       186
 [proguard]   Number of field peephole optimizations:      1
 [proguard]   Number of branch peephole optimizations:     311
 [proguard]   Number of simplified instructions:           99
 [proguard]   Number of removed instructions:              2474
 [proguard]   Number of removed local variables:           82
 [proguard]   Number of removed exception blocks:          53
 [proguard]   Number of optimized local variable frames:   367
 [proguard] Shrinking...
 [proguard] Removing unused program classes and class elements...
 [proguard]   Original number of program classes: 312
 [proguard]   Final number of program classes:    297
 [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:           631   (disabled)
 [proguard]   Number of privatized methods:                1
 [proguard]   Number of staticized methods:                1
 [proguard]   Number of finalized methods:                 0
 [proguard]   Number of removed method parameters:         68
 [proguard]   Number of inlined constant parameters:       39
     [proguard]   Number of inlined constant return values:    13
 [proguard]   Number of inlined short method calls:        0
 [proguard]   Number of inlined unique method calls:       1
 [proguard]   Number of inlined tail recursion calls:      0
 [proguard]   Number of merged code blocks:                0
 [proguard]   Number of variable peephole optimizations:   35
 [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:     17
 [proguard]   Number of simplified instructions:           44
 [proguard]   Number of removed instructions:              676
 [proguard]   Number of removed local variables:           17
 [proguard]   Number of removed exception blocks:          0
 [proguard]   Number of optimized local variable frames:   19
 [proguard] Shrinking...
 [proguard] Removing unused program classes and class elements...
 [proguard]   Original number of program classes: 297
     [proguard]   Final number of program classes:    297
 [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:           631   (disabled)
 [proguard]   Number of privatized methods:                0
 [proguard]   Number of staticized methods:                1
 [proguard]   Number of finalized methods:                 0
 [proguard]   Number of removed method parameters:         14
 [proguard]   Number of inlined constant parameters:       10
 [proguard]   Number of inlined constant return values:    14
 [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:   8
 [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:     1
 [proguard]   Number of simplified instructions:           4
 [proguard]   Number of removed instructions:              33
 [proguard]   Number of removed local variables:           5
 [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: 297
 [proguard]   Final number of program classes:    297
 [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:           631   (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:    14
 [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 simplified instructions:           0
 [proguard]   Number of removed instructions:              4
 [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: 297
 [proguard]   Final number of program classes:    297
 [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:           631   (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:    14
 [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:   1
     [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 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] Shrinking...
 [proguard] Removing unused program classes and class elements...
 [proguard]   Original number of program classes: 297
 [proguard]   Final number of program classes:    297
 [proguard] Obfuscating...
 [proguard] Printing mapping to [/bin/proguard/mapping.txt]...
 [proguard] Preverifying...
     [proguard] Writing output...
 [proguard] Preparing output jar [/bin/proguard/obfuscated.jar]
     [proguard]   Copying resources from program jar     [/bin/proguard/original.jar]
 [proguard]   Copying resources from program jar     [/libs/CabJar.jar]
 [proguard] Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry     [CabJar.jar:META-INF/MANIFEST.MF])
 [proguard]   Copying resources from program jar     [/libs/android-support-v4.jar]
 [proguard] Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry         [android-support-v4.jar:META-INF/MANIFEST.MF])
 [proguard]   Copying resources from program jar     [/libs/libGoogleAnalytics.jar]
 [proguard] Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry     [libGoogleAnalytics.jar:META-INF/MANIFEST.MF])
 [proguard] Printing classes to [/bin/proguard/dump.txt]...
-dex:
     [echo] Converting compiled files and external libraries into     /bin/classes.dex...
    [apply] UNEXPECTED TOP-LEVEL EXCEPTION:
    [apply] com.android.dx.cf.code.SimException: local 0000: invalid
    [apply]     at     com.android.dx.cf.code.OneLocalsArray.throwSimException(OneLocalsArray.java:244)
    [apply]     at     com.android.dx.cf.code.OneLocalsArray.get(OneLocalsArray.java:156)
    [apply]     at com.android.dx.cf.code.BaseMachine.localArg(BaseMachine.java:207)
    [apply]     at     com.android.dx.cf.code.Simulator$SimVisitor.visitLocal(Simulator.java:580)
        [apply]     at     com.android.dx.cf.code.BytecodeArray.parseInstruction(BytecodeArray.java:384)
    [apply]     at com.android.dx.cf.code.Simulator.simulate(Simulator.java:99)
    [apply]     at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:684)
    [apply]     at com.android.dx.cf.code.Ropper.doit(Ropper.java:639)
            [apply]     at com.android.dx.cf.code.Ropper.convert(Ropper.java:252)
    [apply]     at     com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:252)
        [apply]     at     com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:131)
    [apply]     at     com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:85)
    [apply]     at com.android.dx.command.dexer.Main.processClass(Main.java:369)
    [apply]     at com.android.dx.command.dexer.Main.processFileBytes(Main.java:346)
    [apply]     at com.android.dx.command.dexer.Main.access$400(Main.java:59)
    [apply]     at     com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:294)
[apply]     at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
[apply]     at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130)
[apply]     at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
[apply]     at com.android.dx.command.dexer.Main.processOne(Main.java:313)
[apply]     at com.android.dx.command.dexer.Main.processAllFiles(Main.java:233)
[apply]     at com.android.dx.command.dexer.Main.run(Main.java:185)
[apply]     at com.android.dx.command.dexer.Main.main(Main.java:166)
[apply]     at com.android.dx.command.Main.main(Main.java:90)
[apply] ...at bytecode offset 0000001a
[apply] locals[0000]: <invalid>
[apply] locals[0001]: [C
[apply] locals[0002]: Ljava/io/PrintWriter;
[apply] locals[0003]: Ljava/lang/Object;
[apply] locals[0004]: <invalid>
[apply] locals[0005]: <invalid>
[apply] locals[0006]: <invalid>
[apply] locals[0007]: J
[apply] locals[0008]: <invalid>
[apply] ...while working on block 0019
[apply] ...while working on method b:(JLjava/io/PrintWriter;)V
[apply] ...while processing b (JLjava/io/PrintWriter;)V
[apply] ...while processing android/support/v4/b/c.class
[apply] 1 error; aborting

建立失败 /build.xml:547:执行此行时发生以下错误: /build.xml:278:apply返回:1

感谢您的帮助

2 个答案:

答案 0 :(得分:5)

我删除了该选项:

-optimizationpasses 5

在android sdk生成的proguard.cfg中

它有效。

我不知道这个选项到底在做什么。

答案 1 :(得分:2)

我遇到了同样的问题,通过添加!code / allocation / variable修复了问题。请参阅Eric Lafortune的答案:Compile with Proguard gives SimException: "local variable type mismatch"