Android Studio 3.0——unable to resolve dependency for cordovalib

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android Studio 3.0——unable to resolve dependency for cordovalib相关的知识,希望对你有一定的参考价值。

android Studio 3.0 更新了gradle后,项目竟然开始报错unable to resolve dependency for cordovalib...打开build.gradle看了后其中dependencies是这样写的

dependencies {
   compile fileTree(dir: libs, include: *.jar)
// SUB-PROJECT DEPENDENCIES START
debugCompile(project(path: "CordovaLib", configuration: "debug")) 
releaseCompile(project(path: "CordovaLib", configuration: "release"))
感觉没毛病,非常nice,于是特地查了下3.0版的dependencies是否有变动,一查果然有妖孽作祟,如果你没有一个libary项目,原来的写法并不会有问题,但加入一个lib的写法
需做如下改动
dependencies {
    implementation fileTree(dir: libs, include: *.jar)
    // SUB-PROJECT DEPENDENCIES START
//    debugCompile(project(path: "CordovaLib", configuration: "debug"))
//    releaseCompile(project(path: "CordovaLib", configuration: "release"))
    // SUB-PROJECT DEPENDENCIES END
    implementation project(:CordovaLib)
    debugImplementation project(:CordovaLib)
    releaseImplementation project(:CordovaLib)
}

将compile替换成implementation即可完美解决上述问题

以上是关于Android Studio 3.0——unable to resolve dependency for cordovalib的主要内容,如果未能解决你的问题,请参考以下文章

Android Studio - Unable to create Debug Bridge: Unable to start adb server: adb server version (32)

打开Android Studio时报Unable to access Android SDK add-on list

Android Studio启动时出现unable to access android sdk add-on list

android studio 3.0 android profiler怎么看

[转]Android Studio启动时出现unable to access android sdk add-on list

Android Studio:Unable to add window android.view.ViewRootImpl$W@5e2d85a -- permission denied for thi