android: Problem building nativescript-google-maps-sdk on Android
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 android@4.1.0 - the build works on android@4.0.1
More detailed info on the plug-in page.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 16 (1 by maintainers)
@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-pluginchangeUSERNAMEto 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
Looks like in the latest version of build.gradle they moved one jcenter() but forgot to move the other one.
Faulty version:
Working version:
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.
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 ``
This fixed the problem.
Thank you.
@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.
Guessing just not reopened, hang on
So I got it to build but only after I manually changed global installed nativescript’s
vendor/gradle-plugin/build.gradlefile and put “google()” on the top in the repositories list. If I donpm remove -g nativescript && npm install -g nativescriptand clear out thenode_modulesdirectory, it fails to build again.I think it’s a bit too soon to close the issue.