de error: anotaciones no se admiten en -source 1,3 (uso -source 5 o superior para permitir anotaciones)

Pedram Davoodi:

Soy nuevo en Android y construyo mi primer proyecto de prueba en el estudio androide pero sale este error

compilador de Java

error: annotations are not supported in -source 1.3
(use -source 5 or higher to enable annotations)

¿cómo puedo solucionarlo?

Este es el error

Y esta es mi Gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
        
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}


allprojects {
    repositories {
        google()
        jcenter()
        
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Vivekanandan:

También tuve el mismo problema, el problema era que mi sourceCompatibilityy targetCompatibilityen compileOptionsapuntaban a kotlin_versionlos puso a sus versiones de Java correctos en el nivel de proyecto build.gradlede archivo.

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "x.y.z"
        minSdkVersion 22
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }
    buildToolsVersion = '28.0.3'
}

Supongo que te gusta

Origin http://43.154.161.224:23101/article/api/json?id=312356&siteId=1
Recomendado
Clasificación