gpt4 book ai didi

android - 项目构建失败 : Task 'compileDebug' is ambiguous in root project

转载 作者:太空狗 更新时间:2023-10-29 14:10:18 55 4
gpt4 key购买 nike

在我将我的项目与 gradle 文件 同步后,一切正常,我在 gradle 控制台上收到了 BUILD SUCCESSFUL 消息,但是当我运行我的项目时,我得到了这个留言:

 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_05\bin\java.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

当我运行 stacktrace 时,我得到了这个:

FAILURE: Build failed with an exception.

* What went wrong:
Task 'compileDebug' is ambiguous in root project 'PROJECT_NAME'. Candidates are: 'compileDebugAidl', 'compileDebugAndroidT
estAidl', 'compileDebugAndroidTestJava', 'compileDebugAndroidTestNdk', 'compileDebugAndroidTestRenderscript', 'compileDebugAndr
oidTestSources', 'compileDebugJava', 'compileDebugNdk', 'compileDebugRenderscript', 'compileDebugSources', 'compileDebugUnitTes
tJava', 'compileDebugUnitTestSources'.

* Try:
Run gradlew tasks to get a list of available tasks. Run with --info or --debug option to get more log output.

现在我不知道为什么会收到此错误。起初我在 libs 文件夹和 gradle 文件中添加了几个 jars 文件,它运行良好,没有错误,但现在由于某种原因它没有。即使我从 gradle 中删除了 jar ,它仍然无法编译。因此,如果有人可以向我解释编译调试 的含义以及为什么我会收到此错误。

渐变:

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "PACKAGE_NAME"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
// compile files('jsoup-1.8.1.jar')
// compile files('ytd2.jar')
// compile files('youtubeSearchApi.jar')
}

list :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="PACKAGE_NAME" >

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
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>

最佳答案

我在运行任务时遇到了类似的问题:

gradle compile

FAILURE: Build failed with an exception.

* What went wrong:
Task 'compile' is ambiguous in root project 'testApp'. Candidates are:'compileJava', 'compileTestJava'.`

我认为这是编译依赖项的问题,但这是任务本身的问题。我需要将任务运行为:

gradle compileJava

我最好的猜测是,如果你没有使用像“gradle compileDebug”这样的命令,那么其中一个 android 配置正在执行任务,它不能很好地与你的 build.gradle 一起工作。

这是一个似乎与您的问题特别相关的链接。 Click Here

关于android - 项目构建失败 : Task 'compileDebug' is ambiguous in root project,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29540773/

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