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
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)
and build.gradle(Module: android)
Please how do i fix the issue and run my app in an emulator?
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'
}
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'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With