studio3.1.2 配置 annotations4.4.0(亲测成功)

配置更改两个地方,本人亲测

1.app中

 

apply plugin: 'com.android.application'
def AAVersion = '4.4.0'
android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        javaCompileOptions{
            annotationProcessorOptions{
                arguments = ['resourcePackageName':"com.example.myapplication"]
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.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'

    annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
    implementation "org.androidannotations:androidannotations-api:$AAVersion"

}

2.全部中:

 

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

buildscript {
    
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'

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

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

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

第一步:

在res/layout文件夹下创建自己想要的目录(有几个模块就建几个目录)

第二步:

在创建好的模块目录下,创建layout文件夹

第三步:

将布局文件放入相应的layout文件夹

第四步:

打开app/build.gradle,在android{}中加入以下代码

 

sourceSets {
        main {
            res.srcDirs =
                    [
                            'src/main/res/layout/account',
                            'src/main/res/layout/around',
                            'src/main/res/layout/home',
                            'src/main/res/layout/map',
                            'src/main/res/layout/pay',
                            'src/main/res/layout/umeng',
                            'src/main/res/layout',
                            'src/main/res'
                    ]
        }
    }

最后,编译一下,成功解决问题。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值