我正在尝试制作一个应用程序,它使用谷歌翻译API。因为我增加了
compile 'com.google.cloud:google-cloud-translate:1.12.0'在我的build.gradle中出现了一个错误:
Error:Execution failed for task ':app:javaPreCompileDebug'.注释处理器必须立即显式声明。编译类路径上的下列依赖项包含注释处理器。请将它们添加到annotationProcessor配置中。-auto 1.2.jar(com.google.auto.value:auto:1.2),将android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true设置为继续先前的行为。请注意,此选项已被取消,并将在将来删除。有关更多详细信息,请参阅https://developer.android.com/r/tools/annotation-processor-error-message.html。
然后我也加入了
annotationProcessor 'com.google.auto.value:auto-value:1.2'对于build.gradle中的依赖项,我得到了以下错误:
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.找到了多个与操作系统无关的路径“project.properties”的文件
这里有人能帮我吗?
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.google.cloud:google-cloud-translate:1.12.0'
annotationProcessor 'com.google.auto.value:auto-value:1.2'
}发布于 2017-11-27 11:58:55
推杆
packagingOptions {
exclude 'project.properties'
exclude 'META-INF/INDEX.LIST'
}我的build.gradle解决了这个问题。
发布于 2017-11-22 13:04:51
尝尝这个。
compile('com.google.cloud:google-cloud-translate:1.12.0') {
exclude module: 'httpclient' //by artifact name
exclude group: 'org.apache.httpcomponents' //by group
exclude group: 'com.google.code.findbugs'
exclude group: 'org.json', module: 'json'
}它解决了我的问题。
编辑
将此添加到依赖项{}块之前。
为了解决
错误:任务':app:transformResourcesWithMergeJavaResForDebug'.执行失败
packagingOptions {
exclude 'META-INF/NOTICE' // will not include NOTICE file
exclude 'META-INF/LICENSE' // will not include LICENSE file
// as noted by @Vishnuvathsan you may also need to include
// variations on the file name. It depends on your dependencies.
// Some other common variations on notice and license file names
exclude 'META-INF/notice'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license'
exclude 'META-INF/license.txt'
}https://stackoverflow.com/questions/47435023
复制相似问题