Failed to transform file '**.jar' to match attributes {artifactType=android-classes} using transform

最近接手别人项目用androidStudio 3.0.0编译时发现错误如下:

Could not resolve all files for configuration ':view-busipresenter:debugAndroidTestRuntimeClasspath'.
> Failed to transform file 'appbase.jar' to match attributes {artifactType=android-classes} using transform JarTransform
   > Transform output file C:\Users\wenpingm\Desktop\A8_Project\source_code\Settings\funcpresenter-model\jar\appbase.jar does not exist.
> Failed to transform file 'systemService-proxy.jar' to match attributes {artifactType=android-classes} using transform JarTransform
   > Transform output file C:\Users\wenpingm\Desktop\A8_Project\source_code\Settings\funcpresenter-model\jar\systemService-proxy.jar does not exist.

后来网上找了大半天,也有类似差不多的问题,尝试过都不行,后来自己在仔细阅读浏览build文件时发现真正引起错误的原因如下:

-   compile fileTree(include: ['*.jar'], dir: 'libs')
    //        implementation 'com.android.support:appcompat-v7:27.1.1'
    //    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    //    testImplementation 'junit:junit:4.12'
    //    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    //    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    compile files('jar/appbase.jar')
    compile files('jar/systemService-proxy.jar')

总结:从上面可以看出 compile fileTree(.jar)和下面compile files(‘jar/appbase.jar’)是重复的,当然也有别的原因引起这样的原因,记得谷歌官方论坛也有人提过这样错误,说是gradle 本身有点小bug,原文引用如下“It turns out that this is a weird bug in the Gradle itself. I posted it on google forum and one of their coders gave me a solution and also put it up as an issue with the gradle team.”

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值