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

本文详细介绍在AndroidStudio3.4.1中配置AndroidAnnotations的三步简易流程,包括修改项目与模块的build.gradle文件及依赖,适用于Android开发人员快速上手。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

第一步:打开项目的build.gradle
项目的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

 

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)

 

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值