Android Studio3.4 配置中 AndroidAnnotations 成功使用

简单实现在android studio3.4.1 中配置 AndroidAnnotations 的步骤,一共三步,请继续向下看吧。

第一步:打开项目的build.gradleAndroid Studio3.4 配置中 AndroidAnnotations 成功使用_第1张图片
项目的build.gradle

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

buildscript {
    repositories {
        jcenter()
        google()

        //新加 AndroidAnnotations
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'

        //老版本 AndroidAnnotations 删掉就可以
//        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
        //新加 AndroidAnnotations
        mavenCentral()

    }
}

第二步 打开mode的build.gradle

Android Studio3.4 配置中 AndroidAnnotations 成功使用_第2张图片

Android Studio3.4 配置中 AndroidAnnotations 成功使用_第3张图片

 

mode的build.gradle

  defaultConfig {

        applicationId "xxxxxx"
        //应用支持的最新sdk版本4.0
        minSdkVersion 18
        targetSdkVersion 23
        versionCode 30
        versionName "2.8.6"
        multiDexEnabled true

        javaCompileOptions {
            annotationProcessorOptions {
                //这里的包名和applicationId一致
                arguments = ['resourcePackageName': "xxxxxxx"]
            }
        }

    }

def  AAVersion ="4.4.0"

dependencies {
    // 编译libs目录下的所有jar包
    implementation fileTree(dir: 'libs', include: ['*.jar'])
  
    annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
    implementation "org.androidannotations:androidannotations-api:$AAVersion"


//    apt 'org.androidannotations:androidannotations:3.3.2'
//    compile  'org.androidannotations:androidannotations-api:3.3.2'

}
//apt {
//    arguments {
//        androidManifestFile variant.outputs[0].processResources.manifestFile
//        resourcePackageName 'com.winekar.app'
//    }
//}

第三步 点击Make Project(Ctrl +F9)

 

如有帮助,感谢领取支付宝红包

你可能感兴趣的:(AS-Android)