gpt4 book ai didi

java - Android - 处理构建不编译

转载 作者:太空狗 更新时间:2023-10-29 15:09:26 25 4
gpt4 key购买 nike

我在 IDE 处理方面遇到问题。

我正在尝试为 Android 编译一些东西。当然,我在 Android 模式下。但是我在编译时遇到了这个错误。 (不是代码本身)

我已经安装了“adb devices”,看起来没问题。我已经完成了所有“51-android.rules”流程。我已经安装了 API 10(请求的那个)和 Android 工具。我真的不知道哪里出了问题。

-----------------
API<=15: Adding annotations.jar to the classpath.
[echo] ----------
[echo] Building Libraries with 'debug'...
[subant] No sub-builds to iterate on

-code-gen:
Merging AndroidManifest files into one.
Manifest merger disabled. Using project manifest only.
[echo] Handling aidl files...
No AIDL files to compile.
[echo] ----------
[echo] Handling RenderScript files...
No RenderScript files to compile.
[echo] ----------
[echo] Handling Resources...
Generating resource IDs...

BUILD FAILED
/home/user/adt-bundle-linux-x86_64-20130729/sdk/tools/ant/build.xml:649: The following error occurred while executing this line:
/home/user/adt-bundle-linux-x86_64-20130729/sdk/tools/ant/build.xml:690: Execute failed: java.io.IOException: Cannot run program "/home/user/adt-bundle-linux-x86_64-20130729/sdk/build-tools/18.0.1/aapt" (in directory "/tmp/android8933435574063638939sketch"): java.io.IOException: error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at java.lang.Runtime.exec(Runtime.java:593)
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
at com.android.ant.AaptExecTask.execute(AaptExecTask.java:699)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at processing.mode.android.AndroidBuild.antBuild(AndroidBuild.java:415)
at processing.mode.android.AndroidBuild.build(AndroidBuild.java:73)
at processing.mode.android.AndroidMode.handleRunDevice(AndroidMode.java:220)
at processing.mode.android.AndroidEditor$14.run(AndroidEditor.java:310)
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
at java.lang.ProcessImpl.start(ProcessImpl.java:65)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 44 more

Total time: 2 seconds

问题出在“build.xml”脚本的这一部分:

   <echo level="info">----------</echo>
<echo level="info">Handling Resources...</echo>
<aapt executable="${aapt}"
command="package"
verbose="${verbose}"
manifest="${out.manifest.abs.file}"
originalManifestPackage="${project.app.package}"
androidjar="${project.target.android.jar}"
rfolder="${gen.absolute.dir}"
nonConstantId="${android.library}"
libraryResFolderPathRefid="project.library.res.folder.path"
libraryPackagesRefid="project.library.packages"
libraryRFileRefid="project.library.bin.r.file.path"
ignoreAssets="${aapt.ignore.assets}"
binFolder="${out.absolute.dir}"
proguardFile="${out.absolute.dir}/proguard.txt">
<res path="${out.res.absolute.dir}" />
<res path="${resource.absolute.dir}" />
</aapt>

根据错误日志,这是第 690 行:proguardFile="${out.absolute.dir}/proguard.txt">

但是我不知道该怎么办。你能帮我一下吗?我在这上面浪费了很多时间。从昨天早上开始,我就遇到了麻烦。我在没有帮助的情况下在谷歌上搜索过。

编辑:

我已经删除并重新安装了工具包,SDK Manager 的控制台给了我这个错误:

Validate XML: https://dl-ssl.google.com/android/repository/sys-img/x86/sys-img.xml
Parse XML: https://dl-ssl.google.com/android/repository/sys-img/x86/sys-img.xml
Found Intel x86 Atom System Image, Android API 10, revision 2
Found Intel x86 Atom System Image, Android API 15, revision 1
Found Intel x86 Atom System Image, Android API 16, revision 1
Found Intel x86 Atom System Image, Android API 17, revision 1
Done loading packages.
Preparing to install archives
Downloading Android SDK Platform-tools, revision 18.0.1
Installing Android SDK Platform-tools, revision 18.0.1
**Stopping ADB server failed (code -1).**
Installed Android SDK Platform-tools, revision 18.0.1
Downloading Android SDK Build-tools, revision 18.0.1

最佳答案

我也遇到过这个问题,显然有两个可能的原因:

  • 显然是 aapt 的位置已被最新版本的 SDK 工具 v22 更改。我不确定删除该版本的工具是否会修复它,或者是否会推荐这样做。 This thread有一些可能有效的修复。

  • 如果这不能解决问题,您可能正在尝试在没有安装 32 位运行时的 64 位系统上运行 32 位 aapt。在这种情况下,修复来自 this thread可能会解决问题:

    sudo apt-get --no-install-recommends 安装 ia32-libs-multiarch

就我而言,这些修复中只有第二个是必要的。顺便说一下,我应该指出我是通过 Phonegap 构建 android,所以用例可能不会 100% 匹配。然而,同样的问题出现在完全相同的行上,其中 ant 尝试执行 aapt。

(题外话:问题不一定出在第 690 行,我认为只是给出第 690 行是因为它是指定执行 aapt 的“子句”的结尾。)

关于java - Android - 处理构建不编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18253544/

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