gpt4 book ai didi

Android:使用 Ant Release 构建 apk 时出现问题

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:44:03 25 4
gpt4 key购买 nike

我在 eclipse 中构建我的应用程序没有问题,但是一旦我尝试通过 ant 来构建它,它就无法构建。我用过“android update project -p”。生成构建 build.xml 和 proguard.cfg 文件。我尝试了“ant compile”,它也构建得很好。该应用程序包括一个 android 库,如果需要,还具有外部库。这里有人是我尝试执行“ant release”时打印出的错误,

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.util.ExceptionWithContext
at com.android.dx.util.ExceptionWithContext.withContext(ExceptionWithContext.java:46)
at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:340)
at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:131)
at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:85)
at com.android.dx.command.dexer.Main.processClass(Main.java:369)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:346)
at com.android.dx.command.dexer.Main.access$400(Main.java:59)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:294)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:134)
at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:190)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:122)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)
at com.android.dx.command.dexer.Main.processOne(Main.java:313)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:233)
at com.android.dx.command.dexer.Main.run(Main.java:185)
at com.android.dx.command.dexer.Main.main(Main.java:166)
at com.android.dx.command.Main.main(Main.java:90)
Caused by: java.lang.NullPointerException
at com.android.dx.cf.code.ConcreteMethod.<init>(ConcreteMethod.java:84)
at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:243)
... 23 more

我现在很困惑,所以希望有人能给出一些启示。

最佳答案

我想我的答案是 this page也适用于此错误。当您在死代码中初始化匿名类时会发生这种情况。

为什么它只发生在发布中而不发生在调试中的一个解释是,死代码在优化时被删除。

关于Android:使用 Ant Release 构建 apk 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7200421/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com