簡體   English   中英

Android:錯誤:-source 1.3 不支持注釋

[英]Android: error: annotations are not supported in -source 1.3

我嘗試添加一些模塊,當我重建項目時出現此錯誤:

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

我刪除了模塊,但錯誤仍然存​​在。 嘗試清理和重建,沒有幫助。

我理解它與java maven有關,但我不明白如何解決它。 也許這里有人可以幫忙?

這是我的搖籃:

buildscript {
ext.kotlin_version = '1.3.31'
repositories {
    google()
    jcenter()

}
dependencies {
    classpath 'com.android.tools.build:gradle:3.4.1'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath 'com.google.gms:google-services:4.2.0'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
 }

allprojects {
repositories {
    google()
    jcenter()
    maven {
        url "https://maven.java.net/content/groups/public/"
    }

    maven { url 'https://jitpack.io' }

    maven { url "https://maven.google.com" }


  }
}

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






apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'


android {
   compileSdkVersion 28
   defaultConfig {
      applicationId "com.eldareini.kotlin.meet4match"
      minSdkVersion 21
      targetSdkVersion 28
      versionCode 1
      versionName "1.0"
      testInstrumentationRunner 
  "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

packagingOptions {
    pickFirst 'META-INF/LICENSE.txt' // picks the JavaMail license file
}
compileOptions {
    sourceCompatibility = kotlin_version
    targetCompatibility = kotlin_version
}
   buildToolsVersion = '28.0.3'
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.sun.mail:android-mail:1.6.0'
implementation 'com.sun.mail:android-activation:1.6.0'
implementation 'com.github.mac229.FragmentUtils:fragmentutils-kt:1.0.1'
implementation 'com.github.mac229.FragmentUtils:fragmentutils:1.0.1'
implementation 'com.sun.mail:android-mail:1.6.0'
implementation 'com.sun.mail:android-activation:1.6.0'
implementation 'org.webrtc:google-webrtc:1.0.+'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

您正在使用庫的 Kotlin 版本來指定構建的源/目標兼容性。

問題在這里:

compileOptions {
    sourceCompatibility = kotlin_version
    targetCompatibility = kotlin_version
}

kotlin_version1.3

請嘗試以下操作:

compileOptions {
    sourceCompatibility = '1.8'
    targetCompatibility = '1.8'
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM