question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build failing with 'Could not find method google() for arguments [] on repository container'

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:35
  • Comments:34

github_iconTop GitHub Comments

243reactions
msandcommented, Jan 21, 2018

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

#Thu Jan 18 18:05:34 EET 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
47reactions
msandcommented, Jan 21, 2018

Try changing to this:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        google()
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix "ERROR: Could not find method google() for ...
This error is sometimes generated when you try to run a project created using an older version of Flutter than the one you're...
Read more >
Could not find method google() for arguments [] on repository ...
But during compilation we are getting below error message in console. FAILURE: Build failed with an exception.
Read more >
Build failing with 'Could not find method google() for ... - GitHub
No worries. You can find it in appName/android/app/build.gradle where appName is the root of your project.
Read more >
Could not find method google() for arguments [] on repository ...
My gradle file // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() ...
Read more >
Fix "Error Could not find method implementation() for ...
Implementation is a dependency configuration used for library declaration and was introduced in the Android Gradle Plugin 3.0 by Google.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found