项目引入aar报错ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Failed to tr

引入aar报错: ERROR: Unable to resolve dependency for ‘:app@debugUnitTest/compileClasspath’: Failed to transform artifact ‘xwalk_core_library-23.53.589.4-arm.aar (:xwalk_core_library-23.53.589.4-arm:)’ to match attributes {artifactType=jar}.

这两天要使用第三方webview,我引入了Intel的crosswalk内核的webview,这个crosswalk是一个aar的文件,从官网 http://npm.taobao.org/package/react-native-crosswalk-webview-plus/v/1.3.0 找到了如何拿到这个aar文件,然后按照提示步骤,总是报错:ERROR: Unable to resolve dependency for ‘:app@debugUnitTest/compileClasspath’: Failed to transform artifact ‘xwalk_core_library-23.53.589.4-arm.aar (:xwalk_core_library-23.53.589.4-arm:)’ to match attributes {artifactType=jar}.

操作步骤:

官网看到最新的版本是1.3版本下载通过npm命令下载安装crosswalk,

npm install react-native-crosswalk-webview-plus

第二步:到路径node_modules/react-native-webview-crosswalk/libs/xwalk_core_library-23.53.589.4-arm.aar找到这个aar,直接拉入libs文件夹,
第三部,就是好在Android studio中进行一番配置:

在android/app/build.gradle这个目录下配置:
repositories {
    flatDir {
        dirs 'libs'
    }
}

dependencies {
  ...
  implementation (name: "xwalk_core_library-23.53.589.4-arm", ext: "aar")     // <--- add this line
}

OK,基本上到这里就配置完成了,同步项目工程不应该报错了,但是问题就是一直报错:ERROR: Unable to resolve dependency for ‘:app@debugUnitTest/compileClasspath’: Failed to transform artifact ‘xwalk_core_library-23.53.589.4-arm.aar (:xwalk_core_library-23.53.589.4-arm:)’ to match attributes {artifactType=jar}.
查了很多资料,基本上都没有解决,不过在Stack Overflow查到一个看起来很有用的说法,implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])看起来能解决问题,但是依然没有什么卵用,也就是说这么改其实没用。

解决

其实,到这里,查询了得有四五十篇相关资料了,总结出大概有一个可能是这个aar有问题。于是我换了一个版本的aar,换成了xwalk_core_library-15.44.384.13-arm,果然,不报错了,真实坑死了,浪费了半个工作日的时间,这里记录一下。

如果aar经过正确的配置依然无法跑起来项目,那么这个aar本身可能就是坏的,就是一个坑,

implementation(name: 'xwalk_core_library-15.44.384.13-arm', ext: 'aar')

到此,更换了aar,解决了问题。

发布了117 篇原创文章 · 获赞 130 · 访问量 24万+
展开阅读全文

AS 3.0 依赖报错,:app@debug/compileClasspath'

10-11

昨天在家里更新了最新的as,然后自己 开了个项目玩玩,但是到依赖glide的时候就有问题了 看了好多方法都没有用。 offline也关了, 也没有用vpn。 报错如下 Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.github.bumptech.glide:glide:4.8.0. Open File Show Details Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.github.bumptech.glide:glide:4.8.0. Open File Show Details Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.github.bumptech.glide:glide:4.8.0. Open File Show Details Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.github.bumptech.glide:glide:4.8.0. Open File Show Details Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.github.bumptech.glide:glide:4.8.0. Open File Show Details 。。 两个gradle app: apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { applicationId "com.dl.pokemondex" minSdkVersion 26 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { mavenCentral() google() } dependencies { implementation 'com.github.bumptech.glide:glide:4.8.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0' implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.android.support:design:28.0.0' 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' } proj // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() maven { url "https://maven.google.com" } jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.2.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() jcenter() maven { url "https://maven.google.com" } } } task clean(type: Delete) { delete rootProject.buildDir } 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览