无法为com.android.build.gradle.internal.CompileOptions类型的对象获取未知属性'javaVersion'

时间:2018-01-08 08:27:44

标签: android

我在运行项目时遇到此错误。 我在这两行中遇到错误         sourceCompatibility JavaVersion.VERSION_1_8         targetCompatibility javaVersion.VERSION_1_8 我正在改变这些线条 sourceCompatibility JavaVersion.VERSION_1_2         targetCompatibility javaVersion.VERSION_1_2 但面临同样的错误。 我有android studio 2.2.3 这是我的Gradle文件。

apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
    applicationId "com.fcih.gp.furniturego"
    minSdkVersion 17
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
        debuggable true
    }
}

compileOptions{
    sourceCompatibility JavaVersion.VERSION_1_2
    targetCompatibility javaVersion.VERSION_1_2
}
//    compileOptions {
//        sourceCompatibility JavaVersion.VERSION_1_8
//        targetCompatibility JavaVersion.VERSION_1_8
//    }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile(name: 'wikitudesdk', ext: 'aar')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{
    exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:exifinterface:25.4.0'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:customtabs:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.android.support:cardview-v7:25.4.0'
compile 'com.google.firebase:firebase-database:11.0.1'
compile 'com.google.firebase:firebase-auth:11.0.1'
compile 'com.google.firebase:firebase-storage:11.0.1'
compile 'com.firebaseui:firebase-ui-database:2.0.1'
compile 'com.google.android.gms:play-services-auth:11.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.23.0'
compile 'com.twitter.sdk.android:twitter:3.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.makeramen:roundedimageview:2.3.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.7'
compile 'me.grantland:autofittextview:0.2.1'
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.6'
compile 'com.koushikdutta.ion:ion:2.2.1'
}

repositories {
jcenter()
flatDir { dirs 'libs' }
}
apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:0)

将JavaVersion.VERSION_1_8更改为1.8

 compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }