Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not resolve project: CordovaLib

I'm learning how to build app using cordova and I'm currently able to emulate a mobile screen via google chrome browser. I'm attempting to test it on android platform which requires using Android studio (downloaded the 3.0 stable version). After importing the project, Gradle project sync failed and there seems to be issues resolving some dependencies for CordovaLib. See image below

enter image description here

I have gone through several post here and still haven't been able to find a solution or maybe I'm missing the point considering that this is my first time learning with it. Below are the settings for

build.gradle(Module: CordovaLib)

enter image description here

and build.gradle(Module: android)

enter image description here

Please how do i fix the issue and run my app in an emulator?

like image 937
Mena Avatar asked Nov 13 '17 11:11

Mena


2 Answers

Is a typical error of migration, please read the paragraph 'Migrate dependency configurations for local modules':

You should instead 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'
}
like image 160
trocchietto Avatar answered Sep 28 '22 02:09

trocchietto


The solution from trocchietto is correct. Remember you're using "CordovaLib" no "Library" you just have to change like this.

// 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 app-magic for me isn't necessary and I comment it.

My dependencies

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'
}
like image 36
Raul Mendez Sagastume Avatar answered Sep 28 '22 04:09

Raul Mendez Sagastume