Android Studio中的AndroidAnnotations错误

时间:2014-07-10 08:38:36

标签: android android-studio android-annotations

我一直在使用AndriodAnnotations与Eclipse(ADT)没有任何问题。最近,我决定探索Android Studio。在构建应用程序时,使用Android Studio和AndroidAnnotations有一些问题。以下是错误:

enter image description here

当显示三个错误时,我可以毫无问题地运行应用程序。

下面是我的build.gradle:

apply plugin: 'com.android.application'

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2+'
    }
}

apply plugin: 'android'
apply plugin: 'android-apt'

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        applicationId "com.test.restaurantmenu"
        minSdkVersion 15
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

apt {
    arguments {
        androidManifestFile variant.processResources.manifestFile
        resourcePackageName "com.test.restaurantmenu"
    }
}

dependencies {
    apt "org.androidannotations:androidannotations:3.0+"
    compile "org.androidannotations:androidannotations-api:3.0+"
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.github.satyan:sugar:1.3'
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

我已启用注释处理器,如下所示:

enter image description here

我的设置中是否有任何错过或错误的步骤?

2 个答案:

答案 0 :(得分:0)

我安装了“Android SDK Tools 23.0.2”,所有错误都已解决。

enter image description here

答案 1 :(得分:0)

如果您使用的是Kotlin,并且显示错误

  

错误:-source 1.3不支持注释(使用-source 5或   更高以启用注释)

有一种解决方法

  1. 打开项目结构(文件->项目结构)。选择模块。
  2. kotlin 1.3

    更改源兼容性目标兼容性

    jdk 1.8