gpt4 book ai didi

java - Android 注释在库项目中不起作用

转载 作者:行者123 更新时间:2023-11-30 00:39:11 26 4
gpt4 key购买 nike

我在库项目中使用 Android Annotations 框架,但它无法编译。

如果我删除使用 Android 注释的代码,我的项目与库工作正常。

当我添加任何注释时,它会给我错误

Error:Could not find the AndroidManifest.xml file, using generation folder [project_path/build/generated/source/apt/release])

Error:Execution failed for task ':libraryname:compileReleaseJavaWithJavac'.

Compilation failed; see the compiler error output for details.

我使用的是 Android Studio 2.3,所以我没有使用 android-apt 插件,而是从 Android Studio 设置中启用了 Annotation Processor。

我还按照说明将 annotationProcessorOptions 添加到我的库 build.gradle 文件中。

javaCompileOptions {
annotationProcessorOptions {
arguments = ["library": "true",
"resourcePackageName":"com.android.libraryname"]
}
}

关于 Android 注释,我的依赖项看起来也是这样

compile "org.androidannotations:androidannotations-api:$AAVersion"
compile 'org.androidannotations:rest-spring-api:4.1.0'

annotationProcessor "org.androidannotations:androidannotations:$AAVersion
annotationProcessor 'org.androidannotations:rest-spring:4.1.0'

库正常工作正常,客户端项目中的 Android 注释也工作正常,当我尝试在 Android Studio 2.3 版的库项目中使用 Android 注释时出现问题

有什么办法可以解决这个问题,我已经尝试了所有我能找到的方法,但都没有用。

最佳答案

这确实是一个已经修复的错误。 https://github.com/androidannotations/androidannotations/pull/1975

新版本即将发布,在此之前,您可以使用 4.3.0-SNAPSHOT 版本。 https://github.com/androidannotations/androidannotations/wiki/Building-Project-Gradle#snapshots

关于java - Android 注释在库项目中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42822880/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com