3

我遇到了 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
4

1 回答 1

0

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

  • 显然,最近版本的 SDK 工具 v22 更改了aapt的位置。我不确定删除该版本的工具是否会修复它,或者是否建议这样做。该线程有一些可能有效的修复程序。

  • 如果这不能解决问题,您可能正在尝试在未安装 32 位运行时的 64 位系统上运行 32 位 aapt。在这种情况下,此线程的修复可能会解决问题:

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

就我而言,只有第二个修复是必要的。顺便说一句,我应该指出我是通过 Phonegap 构建 android,所以用例可能不是 100% 匹配的。然而,同样的问题发生在同一行,ant 试图执行 aapt。

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

于 2013-09-07T20:51:25.307 回答