react-native-svg: Build failing with 'Could not find method google() for arguments [] on repository container'
Message shown in console after react-native run-android
:
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/jskidd3/Desktop/Apps/AppName/node_modules/react-native-svg/android/build.gradle' line: 4
* What went wrong:
A problem occurred evaluating project ':react-native-svg'.
> Could not find method google() for arguments [] on repository container.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
I installed the plugin in a fresh project on OSX. Versions:
react-native-cli: 2.0.1
react-native: 0.52.0
Android Studio: 3.0.1
My package.json looks like this:
{
"name": "AppName",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.2.0",
"react-native": "0.52.0",
"react-native-svg": "^6.0.1-rc.3",
"react-native-vector-icons": "^4.5.0"
},
"devDependencies": {
"babel-jest": "22.1.0",
"babel-preset-react-native": "4.0.0",
"jest": "22.1.4",
"react-test-renderer": "16.2.0"
},
"jest": {
"preset": "react-native"
}
}
Any ideas as to how I can fix this?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 35
- Comments: 34
Make sure you have v4.1 of the gradle wrapper as well: https://github.com/msand/SVGPodTest/blob/master/android/gradle/wrapper/gradle-wrapper.properties
Try changing to this:
@msand That gives me this:
Output from Gradle Build within Android Studio after clean & rebuild:
Appreciate the fast responses whilst trying to sort this by the way 👍
When you open/build the project in the latest Android studio, it asks if you want it to make these upgrades for you.
same issue
It should mostly make it so that newer android version don’t need to run in backwards compatibility mode. The minSdkVersion 16 set the minimum sdk support level and decided how old versions it works with. https://medium.com/google-developers/picking-your-compilesdkversion-minsdkversion-targetsdkversion-a098a0341ebd
https://developer.android.com/training/basics/supporting-devices/platforms.html#sdk-versions
To maintain your application along with each Android release, you should increase the value of this attribute to match the latest API level, then thoroughly test your application on the corresponding platform version. https://developer.android.com/guide/topics/manifest/uses-sdk-element.html
Just delete the whole android folder and run a command to add.
I got the same error when I use react-native-sqlite-storage , only this website solve my problem , https://github.com/react-native-community/react-native-camera/blob/master/docs/GradleUpgradeGuide.md
Seems you’re using an older version of gradle. Make sure you have v4.1 in: android/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,6 @@ +#Mon Jan 29 13:59:51 EET 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https://services.gradle.org/distributions/gradle-2.14.1-all.zip +distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip
Thanks for solving this but doesn’t updating the API to 25-27 make the apps using this module limited to supporting only 5% of the android market?
I had the same problem and I’ve resolved change the version of my “react-native-svg”: “^6.0.1-rc.1” to “react-native-svg”: “6.0.1-rc.1” and run again npm install .
My react-native-svg module had the version: [Error]
Now its probably the app specific build.gradle file: android/app/build.gradle
Can you check that you have google() in both of these? https://github.com/msand/SVGPodTest/blob/master/android/build.gradle#L6 https://github.com/msand/SVGPodTest/blob/master/android/build.gradle#L24