对于android中的代码混淆,当我给出命令“ant release”时出现以下错误。我搜索了所有但找不到解决方案
Posted
技术标签:
【中文标题】对于android中的代码混淆,当我给出命令“ant release”时出现以下错误。我搜索了所有但找不到解决方案【英文标题】:For the code obfuscation in android i get following error when i give command "ant release" . I searched all over but could not find the solution 【发布时间】:2011-12-28 06:05:32 【问题描述】:Buildfile: C:\Users\**\workspace\Obfuscation\build.xml
-set-mode-check:
-set-release-mode:
-release-obfuscation-check:
-setup:
[echo] Gathering info for Obfuscation...
[setup] android SDK Tools Revision 15
[setup] Project Target: Android 2.2
[setup] API level: 8
[setup]
[setup] ------------------
[setup] Resolving library dependencies:
[setup] No library dependencies.
[setup]
[setup] ------------------
[setup]
-build-setup:
[echo] Creating output directories if needed...
[mkdir] Created dir: C:\**\**\workspace\Obfuscation\libs
-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] Generating resource IDs...
-pre-compile:
-compile:
[javac] C:\Program Files\Eclipse-sdk\android-sdk\tools\ant\build.xml:600: wa
rning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; s
et to false for repeatable builds
[javac] Compiling 1 source file to C:\Users\**\workspace\Obfuscation
\bin\classes
-post-compile:
-obfuscate:
-dex:
[dex] Converting compiled files and external libraries into C:\Users\**
ndhar\workspace\Obfuscation\bin\classes.dex...
[dx] unknown option: --output
[dx] usage:
[dx] dx --dex [--debug] [--verbose] [--positions=<style>] [--no-locals]
[dx] [--no-optimize] [--statistics] [--[no-]optimize-list=<file>] [--no
-strict]
[dx] [--keep-classes] [--output=<file>] [--dump-to=<file>] [--dump-widt
h=<n>]
[dx] [--dump-method=<name>[*]] [--verbose-dump] [--no-files] [--core-li
brary]
[dx] [--num-threads=<n>] [<file>.class | <file>.zip,jar,apk | <direct
ory>] ...
[dx] Convert a set of classfiles into a dex file, optionally embedded
in a
[dx] jar/zip. Output name must end with one of: .dex .jar .zip .apk.
Positions
[dx] options: none, important, lines.
[dx] dx --annotool --annotation=<class> [--element=<element types>]
[dx] [--print=<print types>]
[dx] dx --dump [--debug] [--strict] [--bytes] [--optimize]
[dx] [--basic-blocks | --rop-blocks | --ssa-blocks | --dot] [--ssa-step
=<step>]
[dx] [--width=<n>] [<file>.class | <file>.txt] ...
[dx] Dump classfiles, or tran
[dx] sformations thereof, in a human-oriented format.
[dx] dx --junit [-wait] <TestClass>
[dx] Run the indicated unit test.
[dx] dx -J<option> ... <arguments, in one of the above forms>
[dx] Pass VM-specific options to the virtual machine that runs dx.
[dx] dx --version
[dx] Print the version of this tool (1.6).
[dx] dx --help
[dx] Print this message.
BUILD FAILED
C:\Program Files\Eclipse-sdk\android-sdk\tools\ant\build.xml:729: The following
error occurred while executing this line:
C:\Program Files\Eclipse-sdk\android-sdk\tools\ant\build.xml:731: The following
error occurred while executing this line:
C:\Program Files\Eclipse-sdk\android-sdk\tools\ant\build.xml:743: The following
error occurred while executing this line:
C:\Program Files\Eclipse-sdk\android-sdk\tools\ant\build.xml:249: null returned:
1
Total time: 3 seconds
我使用 android update project 更新了项目,当我命令“ant clean”时构建成功,但是当我向前执行命令“ant release”时,显示了上述失败消息。我正在使用 apache-ant-1.8.2
【问题讨论】:
【参考方案1】:问题出在这里:
-dex:
[dex] Converting compiled files and external libraries into C:\Users\smanandhar\workspace\Obfuscation\bin\classes.dex... [dx] unknown option: --output
构建文件的dex
目标调用带有无效参数的dx
命令。
这会将您带到this SO question,它会提供解决方案的方向
【讨论】:
感谢您的回答。!!路径有问题..一旦我修复它就解决了.. :) @prgt_shrestha。如果正确,请投票/接受答案,以便对其他人有所帮助。见meta.stackexchange.com/questions/5234/…以上是关于对于android中的代码混淆,当我给出命令“ant release”时出现以下错误。我搜索了所有但找不到解决方案的主要内容,如果未能解决你的问题,请参考以下文章
Proguard 使用 DNSJava 库混淆 Android 代码
Proguard 可以混淆 Android 库项目 (APKLIB) 吗?