react-native-image-picker: Could not find com.android.tools:common:25.2.3

Description

I tried to build my react-native application for android. AndroidStudio tell me that common:25.2.3 is undefined in jcenter repository. My build.gradle is configured to use 3.1.4 gradle version.

How to repeat issue and example

Create a new react application (version should be 0.57.7). Install and link react-native-image-picker. Open AndroidStudio, ask it to sync project file with gradle files.

Solution

I edited build.gradle to update 2+ to 3.1.4 and added google in repositories.

Additional Information

  • React Native version: 0.57.7
  • Platform: Android
  • Development Operating System: MacOS
  • Dev tools: Android Studio v3.2.1

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 16

Commits related to this issue

Most upvoted comments

For those that do not use local builds you can edit your app’s build.gradle (not app/build.gradle) to include:

subprojects {project ->
    if (project.name.contains('module name, e.g. react-native-image-picker')) {
            buildscript {
                repositories {
                maven { url "https://dl.bintray.com/android/android-tools/"  }
            }    
        }
    }
}

This will override the current configuration for you. This is for those that can not modify the projects gradle during the build process.

Yes, try to edit node_modules/react-native-image-picker/android/build.gradle and replace buildscript with:

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
    }
}

You should edit classpath 'com.android.tools.build:gradle:3.1.4' according to your main build.gradle (mine is configured to use v3.1.4):

dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'

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

having exact same issue but I don’t feel like editing files in node_modules to get this to work

WHAT IS GOING ON???

@KalebMatthews you save my life! I spent three days looking for it, I don’t know if it is a final solution, but it works!

Is this the same problem you are having? Here’s mine.

A problem occurred configuring project ‘:react-native-image-picker’.

Could not resolve all files for configuration ‘:react-native-image-picker:classpath’. Could not find com.android.tools:common:25.2.3. Searched in the following locations: https://jcenter.bintray.com/com/android/tools/common/25.2.3/common-25.2.3.pom https://jcenter.bintray.com/com/android/tools/common/25.2.3/common-25.2.3.jar Required by: project :react-native-image-picker > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 project :react-native-image-picker > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools.build:manifest-merger:25.2.3 project :react-native-image-picker > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools.ddms:ddmlib:25.2.3 project :react-native-image-picker > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools.analytics-library:shared:25.2.3 project :react-native-image-picker > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools.analytics-library:tracker:25.2.3 project :react-native-image-picker > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools:sdklib:25.2.3 > com.android.tools.layoutlib:layoutlib-api:25.2.3 project :react-native-image-picker > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools:sdklib:25.2.3 > com.android.tools:dvlib:25.2.3 project :react-native-image-picker > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools:sdklib:25.2.3 > com.android.tools:repository:25.2.3