2015-09-26 64 views
1

我已经为我的Android项目添加了注释处理器。它运行时没有错误,并产生预期的结果。不过,我有两个问题会影响我的发展。JVM在注解处理之后永不终止;必须在每次构建之前清理

第一,我每次做项目时,我必须先清洗,或者我得到

error: Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Error reading configuration file 

第二个问题是,当我试图清理,我得到

Error:Execution failed for task ':processor:clean'. 
Unable to delete file: D:\Users\Tony\AndroidProjects\Minder\processor\build\libs\processor.jar 

这似乎是因为运行注释处理器的JVM永远不会终止。如果我进入任务管理器(在Windows上工作)并关闭“Java Platform SE二进制文件”过程,我可以毫无错误地进行清理。清洁后,一切运行良好。

这里是我的我的应用程序模块gradle.build:

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

android { 
compileSdkVersion 22 
buildToolsVersion "22.0.1" 
defaultConfig { 
    applicationId "us.bridgeses.minder" 
    minSdkVersion 16 
    targetSdkVersion 22 
    versionCode 22 
    versionName "2.0-beta" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
    debug { 
     applicationIdSuffix '.debug' 
     versionNameSuffix '-debug' 
    } 
} 
packagingOptions { 
    exclude 'LICENSE.txt' 
    exclude 'META-INF/LICENSE.txt' 
    exclude 'META-INF/services/javax.annotation.processing.Processor' 
} 
} 

dependencies { 
compile project(':processor') 
compile project(':annotations') 
compile 'com.android.support:appcompat-v7:22.2.1' 
compile 'com.android.support:support-v4:22.2.1' 
compile 'com.getbase:floatingactionbutton:1.10.0' 
compile 'com.google.code.gson:gson:2.3.1' 
compile 'org.reflections:reflections:0.9.10' 
compile 'com.h6ah4i.android.materialshadowninepatch:materialshadowninepatch:0.6.3' 
androidTestCompile 'junit:junit:4.11' 
androidTestCompile('com.android.support.test:testing-support-lib:0.1') { 
    exclude group: 'junit' // junit:junit-dep conflicts with junit:unit 
} 
testCompile 'org.robolectric:robolectric:3.0' 
testCompile 'org.robolectric:shadows-support-v4:3.0' 
} 
+0

我有这个问题了。你找到答案了吗? – Hojjat

回答

0

至于成品注释处理器解决方案,您可以使用.jar文件的compiler,而不是整个项目。使用jar将使您能够毫无问题地清理项目。只需将您的compiler.jar添加到库文件夹并用apt files('libs/compiler.jar')替换compile project(':processor')即可。

但我没有找到解决办法修改compiler项目和测试改变,而不clean和终止“Java平台SE二进制”过程

相关问题