AndroidStudio 2.1.2:错误:任务执行失败':app:compileReleaseJavaWithJavac'

时间:2016-08-17 09:19:44

标签: android-studio-2.1

MainActivity.java包含:

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void submitOrder(View view) {
        display(1);
    }

    private void display(int number) {
        TextView quantityTextView = (TextView) findViewById(R.id.quantity_text_view);
        quantityTextView.setText("" + number);
    }
}

编译错误的原因是什么?

gradle.build:

apply plugin: 'com.android.application'

android {     compileSdkVersion 24     buildToolsVersion" 24.0.1"

defaultConfig {
    applicationId "com.example.android.justjava"
    minSdkVersion 15
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

依赖{     编译fileTree(dir:' libs',include:[' * .jar'])     testCompile' junit:junit:4.12'     编译' com.android.support:appcompat-v7:24.1.1' }

我已经尝试过:clean/rebuild project

1 个答案:

答案 0 :(得分:0)

你的compileSdkVersion和buildToolVersion的问题在你的gradle文件中改变了,你应该没问题。    compileSdkVersion 24 buildToolsVersion '24.0.0'

您也可以将targetSdkVersion更新为24