我在Linux上构建适用于Android的MuPDF时遇到了困难。我完全按照How to build MuPDF for Android
的指示进行了操作运行命令'ant debug'时构建失败并出现以下错误 -
/home/georgew/AndroidSDK/android-sdk-linux/tools/ant/build.xml:653:执行此行时发生以下错误:
/home/georgew/AndroidSDK/android-sdk-linux/tools/ant/build.xml:698:null返回:132
我花了一天时间尝试Google可以找到的每个建议的解决方案。它们都会因此错误而失败,除了返回的null值可能会有所不同。
构建系统是运行Scientific Linux 6.3的Pentium4。 Ant是从源代码编译的,因为需要比SL6提供的更新的版本。
以下是运行'ant -d debug'
的最后一行输出 Class com.android.ant.RenderScriptTask$1 loaded from ant loader (parentFirst)
[echo] ----------
[echo] Handling Resources...
Property "android.library" has not been set
[aapt] Generating resource IDs...
Class org.apache.tools.ant.types.Commandline$Argument loaded from parent loader (parentFirst)
[aapt] Current OS is Linux
[aapt] Executing '/home/georgew/AndroidSDK/android-sdk-linux/build-tools/21.0.2/aapt' with arguments:
[aapt] 'package'
[aapt] '-f'
[aapt] '-m'
[aapt] '-0'
[aapt] 'apk'
[aapt] '-M'
[aapt] '/home/georgew/AndroidSDK/src/mupdf/platform/android/bin/AndroidManifest.xml'
[aapt] '-S'
[aapt] '/home/georgew/AndroidSDK/src/mupdf/platform/android/bin/res'
[aapt] '-S'
[aapt] '/home/georgew/AndroidSDK/src/mupdf/platform/android/res'
[aapt] '-I'
[aapt] '/home/georgew/AndroidSDK/android-sdk-linux/platforms/android-16/android.jar'
[aapt] '-J'
[aapt] '/home/georgew/AndroidSDK/src/mupdf/platform/android/gen'
[aapt] '--generate-dependencies'
[aapt] '-G'
[aapt] '/home/georgew/AndroidSDK/src/mupdf/platform/android/bin/proguard.txt'
[aapt]
[aapt] The ' characters around the executable and arguments are
[aapt] not part of the command.
Execute:Java13CommandLauncher: Executing '/home/georgew/AndroidSDK/android-sdk-linux/build-tools/21.0.2/aapt' with arguments:
'package'
'-f'
'-m'
'-0'
'apk'
'-M'
'/home/georgew/AndroidSDK/src/mupdf/platform/android/bin/AndroidManifest.xml'
'-S'
'/home/georgew/AndroidSDK/src/mupdf/platform/android/bin/res'
'-S'
'/home/georgew/AndroidSDK/src/mupdf/platform/android/res'
'-I'
'/home/georgew/AndroidSDK/android-sdk-linux/platforms/android-16/android.jar'
'-J'
'/home/georgew/AndroidSDK/src/mupdf/platform/android/gen'
'--generate-dependencies'
'-G'
'/home/georgew/AndroidSDK/src/mupdf/platform/android/bin/proguard.txt'
The ' characters around the executable and arguments are
not part of the command.
BUILD FAILED
/home/georgew/AndroidSDK/android-sdk-linux/tools/ant/build.xml:653: The following error occurred while executing this line:
/home/georgew/AndroidSDK/android-sdk-linux/tools/ant/build.xml:698: null returned: 132
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:650)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:676)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:502)
at com.android.ant.AaptExecTask.execute(AaptExecTask.java:703)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at com.android.ant.IfElseTask.execute(IfElseTask.java:120)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
at org.apache.tools.ant.Main.runBuild(Main.java:801)
at org.apache.tools.ant.Main.startAnt(Main.java:218)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
答案 0 :(得分:0)
经过深入研究后,问题不在于建立MuPDF。问题是,较新版本的SDK中的aapt是使用SSE2支持编译的,并且在较旧的机器中被破坏。
可用的解决方案是在用于构建的机器上下载和编译SDK,安装SDK并在更现代的机器上构建项目,或者找到没有SSE2编译的最新版本的aapt的副本支持。
我搜索并找到了一个jar文件,apktool-2.0.jar,我从中提取了aapt并且构建成功完成。