【发布时间】:2015-06-14 22:52:30
【问题描述】:
在我将我的项目与 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
当我运行堆栈跟踪时,我得到了这个:
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,它仍然无法编译。因此,如果有人可以向我解释 compile debug 是什么意思以及为什么会出现此错误。
分级:
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')
}
和清单:
<?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>
【问题讨论】:
标签: android android-studio android-gradle-plugin