4

I'm getting this error in when I try to build my app through react-native run-android. It was fine yesterday, but suddenly get this error today.

I already check the react native vector icons and it looks fine, this also working well with iOS.

Here's the error:

   * What went wrong:
A problem occurred configuring project ':react-native-vector-icons'.
> Could not resolve all files for configuration ':react-native-vector-icons:classpath'.
   > Could not find any matches for com.android.tools.build:gradle:2.3.+ as no versions of com.android.tools.build:gradle are available.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml
         https://jcenter.bintray.com/com/android/tools/build/gradle/
     Required by:
         project :react-native-vector-icons

Here's my gradle file:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        google()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        classpath 'com.google.gms:google-services:3.2.0'
        classpath 'io.fabric.tools:gradle:1.+'

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

allprojects {
    repositories {
        mavenLocal()
        google()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven { url 'https://maven.fabric.io/public' }
        maven { url "https://maven.google.com" }
        jcenter()
    }
}

ext {
    buildToolsVersion = "26.0.1"
    minSdkVersion = 16
    compileSdkVersion = 26
    targetSdkVersion = 26
    supportLibVersion = "26.1.0"
}

subprojects {

 project.configurations.all {
    resolutionStrategy.eachDependency { details ->
       if (details.requested.group == 'com.android.support'
              && !details.requested.name.contains('multidex') ) {
           details.useVersion "26.0.1"
        }
     }
  }

  afterEvaluate {project ->
      if (project.hasProperty("android")) {
          android {
              compileSdkVersion rootProject.ext.compileSdkVersion
              buildToolsVersion '26.0.1'
              defaultConfig {
                  targetSdkVersion rootProject.ext.targetSdkVersion
              }
          }
      }
  }
}

What am I missing here?

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Mirsa
  • 87
  • 1
  • 5

4 Answers4

2

Try to update 'react-native-vector-icons' package to the latest version (6.1.0).

m1ha1
  • 95
  • 1
  • 7
1

Base on this link

android licenses. Maybe try $ANDROID_HOME/tools/bin/sdkmanager "build-tools;26.0.1" "platforms;android-26" and see if that helps.

This Image can help you

image

I suggest you to update buildToolsVersion and supportLibVersion

Radesh
  • 13,084
  • 4
  • 51
  • 64
  • Thanks! Works fine now! so i updated the build tools version and also update the react-native-vector-icons, works well now – Mirsa Dec 11 '18 at 13:27
1

Try to add this to your build.gradle file.

subprojects {
    if (project.name.contains('react-native-vector-icons')) {
        buildscript {
            repositories {
                jcenter()
                maven { url "https://dl.bintray.com/android/android-tools/"  }
            }
        }
    }
}
shizhen
  • 12,251
  • 9
  • 52
  • 88
0

I've actually fixed this issue by updating react-native-vector-icons.

The method I used is described HERE