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

标签 java android android-library android-annotations

我在库项目中使用 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/

相关文章:

android - 我的应用程序在我的设备上无法正常运行

android - Gradle 多项目 android 库设置与 maven 本地

java - 使用 android 库时无法解析符号 'validator'

java - Box2D + LibGDX pong,所有主体 "stuck"

java - 非法状态异常 : It's not allowed to delete the file associated with an open Realm

java - 找不到 bundle java.util.PropertyResourceBundle 的资源

java - 非阻塞 while(true) 循环中的 wait(1) 是否比使用 wait() 和 notify() 更有效?

java - 应用程序中的选项卡栏图标与选项卡文本重叠

Android 4.3 低功耗蓝牙不稳定

android - 带 map 和路线的 Android 项目要使用哪些库?