为什么会出现这个错误"任务执行失败':app:compileDebugJavaWithJavac' "发生?

时间:2016-06-05 14:39:30

标签: android android-studio gradle

我是android的初学者。我找到了这个话题但是,这对我没有帮助。我收到了这个错误。但我无法弄清楚我的问题是什么?

注意:我正面临"找不到tools.jar"错误也。我在lib文件夹中使用外部.jar文件。

  apply plugin: 'com.android.application'

 android {
          compileSdkVersion 'Google Inc.:Google APIs:23'
          buildToolsVersion "23.0.3"
           useLibrary 'org.apache.http.legacy'          

defaultConfig {

    minSdkVersion 9
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

 dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile('com.google.apis:google-api-services-drive:v2-rev170-1.20.0') {
            exclude module: 'httpcore'
            exclude module: 'httpclient'
           }
    compile 'com.google.api-client:google-api-client:1.20.0'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.parse:parse-android:1.10.3'



}

2 个答案:

答案 0 :(得分:0)

我想,您已经下载并安装了Java Runtime Environment(JRE)而不是Java Development Kit(JDK)。后者有tools.jar,java.exe,javac.exe等。

答案 1 :(得分:0)

替换

compileSdkVersion 'Google Inc.:Google APIs:23'

compileSdkVersion 23