如何在Linux上为Android构建MuPDF



我在Linux上为Android构建MuPDF时遇到了困难。我完全遵循了如何为Android 构建MuPDF的指导

运行命令"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

我花了一天的时间尝试谷歌能找到的每一个建议的解决方案。除了返回的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)

经过进一步研究,问题不在于构建MuPDF。问题是,较新版本的SDK中的aapt是在支持SSE2的情况下编译的,并且在较旧的计算机中已损坏。

可用的解决方案是在用于构建的计算机上下载并编译SDK,在更现代化的计算机上安装SDK并构建项目,或者查找在不支持SSE2的情况下编译的最新版本的aapt的副本。

我搜索并找到了一个jar文件,apktool-2.0.jar,从中提取了aapt,构建成功完成。

相关内容

  • 没有找到相关文章

最新更新