找不到AndroidManifest.xml文件,使用Android批注后的生成文件夹
在将@EActivity注释添加到我的类后,我无法运行我的项目 这是我的Gradle项目:找不到AndroidManifest.xml文件,使用Android批注后的生成文件夹,android,android-gradle-plugin,android-annotations,Android,Android Gradle Plugin,Android Annotations,在将@EActivity注释添加到我的类后,我无法运行我的项目 这是我的Gradle项目: // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() jcenter() } dependencies { c
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
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 {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是我的Gradle模块:应用程序
apply plugin: 'com.android.application'
def AAVersion = '4.2.0'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.tasks"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
implementation 'com.android.support:support-annotations:28.0.0'
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
implementation "org.androidannotations:androidannotations-api:$AAVersion"
}
在我的Gradle中添加Android注释后,我注意到我的AndroidMannifest没有自动修改(在活动中缺少u),当我手动添加时,它会以红色突出显示
如果我正常运行项目(不修改AndroidManifest或将类更改为注释),它将正常运行
如果我添加注释并修改清单,我将收到错误:
错误:无法使用生成找到AndroidManifest.xml文件
文件夹
[C:\Users\Asusc\AndroidStudioProjects\Tasks\app\build\generated\source\apt\debug])
你知道我可能做错了什么吗?你应该更新到AndroidAnnotations 4.6.0。此版本有Android Gradle插件3.3.+支持。如果您将AndroidAnnotations 4.6.0与Android Gradle插件3.5.+一起使用,您可以将Android Gradle插件版本降级为3.4.1进行修复
classpath 'com.android.tools.build:gradle:3.4.1'
在我的例子中,将此添加到build.gradle修复了它:
android {
...
defaultConfig {
...
javaCompileOptions {
annotationProcessorOptions {
arguments = ["androidManifestFile": "$projectDir/src/main/AndroidManifest.xml".toString()]
}
}
}
}
成功了!我升级了AA4.6.0版本,删除了行实现'com.android.support:support annotations:28.0.0'谢谢!!对我来说不起作用。AAVersion是4.6.0,gradle是3.5.2。@NirojShr请尝试将gradle版本降级为3.4.1。我使用的是AA4.6.0和gradle 3.5.3。虽然我觉得很可笑,我不得不降级到这样一个较旧的版本,Gealle 3.4.1确实工作。降级到年级3.4.1不是一个选项,我想考虑,这个解决方案为我通过。谢谢