Android Annotations could not find AndroidManifest.xml

淺唱寂寞╮ 提交于 2019-12-05 10:47:06

I fixed your build script which should be working regarding AndroidAnnotations:

apply plugin: 'com.android.application'

ext.androidAnnotationsVersion = '3.3.2';

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

apply plugin: 'com.neenbedankt.android-apt'

dependencies {
    apt "org.androidannotations:androidannotations:${androidAnnotationsVersion}"
    compile "org.androidannotations:androidannotations-api:${androidAnnotationsVersion}"
}

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.dev.app_name"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "0.3"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

apt {
    arguments {
        androidManifestFile variant.outputs[0]?.processResources?.manifestFile
        resourcePackageName "com.dev.app_name" // the same as package in the manifest
    }
}

Update: to use with annotationProcessor instead of apt:

android {
    defaultConfig {
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["resourcePackageName": "com.dev.app_name"]
            }
        }
    }
}

And make sure you are using the latest version of AndroidAnnotations.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!