【问题标题】:Gradle can't build Android Project in command line, aapt failsGradle 无法在命令行中构建 Android 项目,aapt 失败
【发布时间】:2016-01-17 02:29:07
【问题描述】:

我在this guide.之后创建了一个基本的Android项目

现在,当我在命令行中运行 gradle(2.10 版)时,出现以下错误:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/opt/android-sdk/build-tools/23.0.2/aapt'' finished with non-zero exit value 1

这是我的 build.gradle 文件:

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'

    }
}

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
}

这是我的 AndroidManifest.xml 文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="org.hello"
    android:versionCode="1"
    android:versionName="1.0.0" >

    <application android:label="@string/app_name" >
        <activity
            android:name=".HelloActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

有趣的是,当我启动 Android Studio(1.5) 并在那里构建一个测试应用程序时,它可以正常工作,但是在命令行中执行它会失败。我尝试从 AS 复制 gradle 文件,但无济于事。我检查了安装路径,应该是aapt。

我在这里很迷茫,因为几个月前我使用了上面的相同指南。今天我更新了我的 Android SDK 安装(编辑:我确保安装了正确的修订版)但我无法正确构建任何东西。

如果您需要更多信息,请告诉我,我卡住了。

【问题讨论】:

  • 你能显示你的命令行吗?

标签: java android gradle


【解决方案1】:

我自己想通了。重新安装 Gradle 后,我终于收到一条新的错误消息,用简单的英文告诉我出了什么问题(这是我的资源有问题)。

这真的很奇怪,因为我以前使用 Archlinux 并且所有其他 Gradle 更新都运行良好。

无论如何感谢任何对此提出想法的人:)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-02
    • 2013-09-06
    • 2012-10-19
    • 2013-08-17
    • 2018-01-04
    相关资源
    最近更新 更多