Failed to solve the project: CordovaLib

I’m learning how to create applications using cordova, and now I can emulate a mobile screen through the Chrome Chrome browser. I am trying to test it on the Android platform, which requires the use of Android studio (I downloaded the version with 3 stable versions). After importing the project, Gradle was unable to synchronize the project , and it seems that there are problems resolving some dependencies for CordovaLib. See image below.

enter image description here

I read a few posts here and still have not been able to find a solution, or maybe I don't have enough sense, given that this is my first learning experience. Below are the settings for

build.gradle (Module: CordovaLib)

enter image description here

and build.gradle (Module: android)

enter image description here

How to solve the problem and run the application in the emulator?

+5
source share
2 answers

This is a typical migration error, please read the paragraph "Migrate dependency configuration for local modules":

Instead, you should configure your dependencies as follows:

dependencies { // This is the old method and no longer works for local // library modules: // debugImplementation project(path: ':library', configuration: 'debug') // releaseImplementation project(path: ':library', configuration: 'release') // Instead, simply use the following to take advantage of // variant-aware dependency resolution. You can learn more about // the 'implementation' configuration in the section about // new dependency configurations. implementation project(':library') // You can, however, keep using variant-specific configurations when // targeting external dependencies. The following line adds 'app-magic' // as a dependency to only the "debug" version of your module. debugImplementation 'com.example.android:app-magic:12.3' } 
+5
source

The solution from trocchietto is the right one. Remember that you are using "CordovaLib" no "Library", which you just need to change as follows.

 // Instead, simply use the following to take advantage of // variant-aware dependency resolution. You can learn more about // the 'implementation' configuration in the section about // new dependency configurations. implementation project(':CordovaLib') 

However, the magic application is not required for me, and I will comment on it.

My addictions

 dependencies { // This is the old method and no longer works for local // compile 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 // Instead, simply use the following to take advantage of // variant-aware dependency resolution. You can learn more about // the 'implementation' configuration in the section about // new dependency configurations. implementation project(':CordovaLib') // You can, however, keep using variant-specific configurations when // targeting external dependencies. The following line adds 'app-magic' // as a dependency to only the "debug" version of your module. //debugImplementation 'com.example.android:app-magic:12.3' } 
0
source

Source: https://habr.com/ru/post/1273319/


All Articles