2017-03-15 26 views
1

我在库项目中使用Android批注框架,但它不能编译。Android批注在库项目中不起作用

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

当我添加任何注释它给我的错误

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的易插件在Android Studio设置,相反,我已经启用注解处理器。

我也按照说明将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注释

有没有什么办法可以解决这个问题,我试过了所有我能找到但没有工作的方法。

回答

1

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

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

+0

我试着使用4.3.0-SNAPSHOT,但它给了我_Failed来解决该错误:org.androidannotations:androidannotations-API:4.3.0-SNAPSHOT_,我也跟着向导,因为它一直在说在这里[4.0-SNAPSHOT未找到](https://github.com/androidannotations/androidannotations/issues/1720),并在我的库中添加Sonatype存储库链接build.gradle – kaplanfat

+0

快照构建现在可用。 – WonderCsabo

+0

不幸的是,在尝试按照AA wiki中的指示构建快照时,我仍然遇到了同样的错误 – kaplanfat

相关问题