Using NS 4.1, tns-core 4.1 and tns-android 4.1.
Getting the following error during build on Android
`Unable to apply changes on device: emulator-5554. Error is: Failed to build plugin nativescript-google-maps-sdk :
Error: Command ./gradlew failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
What went wrong:
Could not resolve all files for configuration ':releaseCompileClasspath'.
Could not find common.jar (android.arch.core:common:1.0.0).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/core/common/1.0.0/common-1.0.0.jar
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1s`
The problem seems to be it's looking for common-1.0.0.jar and it's not on that jcenter site.
This happens on [email protected] - the build works on [email protected]
More detailed info on the plug-in page.
Same problem for me. It's happening when NativeScript is generating .aar from plugins under platforms/tempPlugin/nativescript_PLUGIN. I tried to change build.gradle file's repositories like this:
repositories {
google()
jcenter()
}
&
allprojects {
repositories {
google()
jcenter()
mavenLocal()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
But that file got override each time & show error as above. I tried to prevent overriding & that time it worked. But need a good solution.
@erjdriver got a working solution. You can try this:
Open default build.gradle of nativescript from this location:
for PC: C:\Users\USERNAME\AppData\Roaming\npm\node_modules\nativescript\vendor\gradle-plugin
For Mac: /usr/local/lib/node_modules/nativescript/vendor/gradle-plugin
change USERNAME to your username of PC. Now open the file build.gradle & change 2 parts as bellow:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
mavenLocal()
mavenCentral()
}
}
Now delete platforms directory & try to rebuild the app. It should work.
ref: https://stackoverflow.com/questions/50584437/android-studio-3-1-2-failed-to-resolve-runtime
@jibon57 your solution works very well.
This fixed the problem.
Thank you.
So I got it to build but only after I manually changed global installed nativescript's vendor/gradle-plugin/build.gradle file and put "google()" on the top in the repositories list. If I do npm remove -g nativescript && npm install -g nativescript and clear out the node_modules directory, it fails to build again.
I think it's a bit too soon to close the issue.
Here are my steps to reproduce:
``
$ tns create zzz --tsc
$ cd zzz
$ tns info
✔ Getting NativeScript components versions information...
✔ Component nativescript has 4.1.0 version and is up to date.
✔ Component tns-core-modules has 4.1.0 version and is up to date.
✔ Component tns-android has 4.1.3 version and is up to date.
✖ Component tns-ios is not installed.
$ tns plugin add nativescript-google-maps-sdk
$ tns build android
Failed to build plugin nativescript-google-maps-sdk :
Error: Command ./gradlew failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
What went wrong:
Could not resolve all files for configuration ':releaseCompileClasspath'.
Could not find runtime.jar (android.arch.lifecycle:runtime:1.0.0).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/lifecycle/runtime/1.0.0/runtime-1.0.0.jar
Could not find common.jar (android.arch.core:common:1.0.0).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/core/common/1.0.0/common-1.0.0.jar
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 0s
``
Looks like in the latest version of build.gradle they moved one jcenter() but forgot to move the other one.
Faulty version:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
Working version:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}
}
😥
How is this marked as fixed? The only (working) work around involves modifying the nativescript library manually. This is not a practical or scalable solution.
Guessing just not reopened, hang on
@erjdriver, please re-open this. It needs to be fixed in the library.
@sitefinitysteve, are you able to re-open this, or should I open a separate issue? I am finding this issue when trying to install other plugins as well and it is making the experience quite broken.
Most helpful comment
@erjdriver got a working solution. You can try this:
Open default
build.gradleof nativescript from this location:for PC:
C:\Users\USERNAME\AppData\Roaming\npm\node_modules\nativescript\vendor\gradle-pluginFor Mac:
/usr/local/lib/node_modules/nativescript/vendor/gradle-pluginchange
USERNAMEto your username of PC. Now open the filebuild.gradle& change 2 parts as bellow:Now delete platforms directory & try to rebuild the app. It should work.
ref: https://stackoverflow.com/questions/50584437/android-studio-3-1-2-failed-to-resolve-runtime