React-native: Could not find com.android.tools.build:gradle:2.3.3.

Created on 11 Dec 2018  路  9Comments  路  Source: facebook/react-native

Environment

Environment:
OS: Linux 4.15
Node: 8.11.3
Yarn: Not Found
npm: 5.6.0
Watchman: 4.9.0
Xcode: N/A
Android Studio: Not Found

Packages: (wanted => installed)
react: ~16.3.0-alpha.1 => 16.3.1
react-native: 0.54.4 => 0.54.4

Description

When I sync Gradle using Android Studio and also when run react-native run-android then show below error.

* What went wrong:
A problem occurred configuring project ':react-native-fast-image'.
> Could not resolve all artifacts for configuration ':react-native-fast-image:classpath'.
   > Could not find com.android.tools.build:gradle:2.3.3.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/build/gradle/2.3.3/gradle-2.3.3.pom
         https://jcenter.bintray.com/com/android/tools/build/gradle/2.3.3/gradle-2.3.3.jar
     Required by:
         project :react-native-fast-image

Can anyone give me any solution for this issue, I get stuck here can't go forward.
I upgrade all gradle and others libraries, still getting this issue for many packages which I installed.
My all setting file is below.
My android/build.gradle

ext {
  compileSdkVersion = 28
  buildToolsVersion = "28.0.3"
  minSdkVersion = 16
  targetSdkVersion = 28
  supportLibVersion = "28.0.0"
}

buildscript {
  repositories {
    mavenLocal()
    mavenCentral()
    jcenter()
    google()
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
    classpath 'com.google.gms:google-services:3.1.1'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
  }
}

allprojects {
  repositories {
    mavenLocal()
    maven { url "https://maven.google.com" }
    mave 
    jcenter()
    google()
  }
}

 subprojects {
   afterEvaluate {project ->
     if (project.hasProperty("android")) {
       android {
         compileSdkVersion rootProject.ext.compileSdkVersion
         buildToolsVersion rootProject.ext.buildToolsVersion
       }
     }
   }
 }

task clean(type: Delete) {
  delete rootProject.buildDir
}

My android/app/build.gradle :

apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
    entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"

def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false

android {
  compileSdkVersion rootProject.ext.compileSdkVersion
  buildToolsVersion rootProject.ext.buildToolsVersion

  defaultConfig {
    applicationId "com.project.app"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion 
    versionCode 26
    versionName "4.2.2"
    ndk {
      abiFilters "armeabi-v7a", "x86"
    }
  }

  signingConfigs {
    release {
      storeFile file(MYAPP_RELEASE_STORE_FILE)
      storePassword MYAPP_RELEASE_STORE_PASSWORD
      keyAlias MYAPP_RELEASE_KEY_ALIAS
      keyPassword MYAPP_RELEASE_KEY_PASSWORD
    }
  }

  splits {
    abi {
      reset()
      enable enableSeparateBuildPerCPUArchitecture
      universalApk false  // If true, also generate a universal APK
      include "armeabi-v7a", "x86"
    }
  }
  buildTypes {
    debug {
      buildConfigField "String", "CODEPUSH_KEY", '""'
    }

    release {
      lintOptions {
        disable 'MissingTranslation'
        checkReleaseBuilds false
        abortOnError false
      }
      minifyEnabled enableProguardInReleaseBuilds
      proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
      buildConfigField "String", "CODEPUSH_KEY", '"CODEPUSH_KEY"'
      signingConfig signingConfigs.release
    }

    releaseStaging {
      initWith(buildTypes.release)
      matchingFallbacks = ['debug', 'release', 'releaseStaging'];
      buildConfigField "String", "CODEPUSH_KEY", '"CODEPUSH_KEY"'
    }
  }

  applicationVariants.all { variant ->
    variant.outputs.each { output ->
      def versionCodes = ["armeabi-v7a":1, "x86":2]
      def abi = output.getFilter(OutputFile.ABI)
      if (abi != null) {
        output.versionCodeOverride =
          versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
      }
    }
  }
}

dependencies {
  compile project(':rn-fetch-blob')
  compile 'com.airbnb.android:react-native-maps:0.12.1'
  compile project(':react-native-linear-gradient')
  compile project(':react-native-orientation')
  compile project(':react-native-vector-icons')
  compile project(':react-native-keep-awake')
  compile project(':react-native-video')
  compile project(':react-native-auth0')
  compile project(':react-native-image-picker')
  compile project(':react-native-device-info')
  compile project(':react-native-code-push')
  compile project(':react-native-fcm')
  compile project(':appcenter-crashes')
  compile project(':appcenter-analytics')
  compile project(':appcenter')
  compile project(':react-native-fast-image')
  compile fileTree(dir: "libs", include: ["*.jar"])
  compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
  compile "com.facebook.react:react-native:+" 
  compile 'com.google.firebase:firebase-core:11.0.2' 
  compile 'com.google.android.gms:play-services-base:11.0.2'
  compile 'com.google.android.gms:play-services-maps:11.0.2'
  compile 'com.google.android.gms:play-services-gcm:11.0.2'
}

task copyDownloadableDepsToLibs(type: Copy) {
  from configurations.compile
  into 'libs'
}

apply plugin: 'com.google.gms.google-services'

And My android/gradle/wrapper/gradle-wrapper.properties :

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
Android Linux Locked

All 9 comments

It looks like you are using an older version of React Native. Please update to the latest release, v0.57 and verify if the issue still exists.

The "鈴狾ld Version" label will be removed automatically once you edit your original post with the results of running react-native info on a project using the latest release.

I can confirm that this is also occurring on react-native: 0.57.1

@hramos Why you close this issue? The issue still exists after react native version upgraded.
@react-native-bot My current version is below:
React Native Environment Info:
System:
OS: Linux 4.15 Ubuntu 16.04.5 LTS (Xenial Xerus)
CPU: (4) x64 Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz
Memory: 125.14 MB / 7.69 GB
Shell: 4.3.48 - /bin/bash
Binaries:
Node: 8.11.3 - /usr/bin/node
npm: 5.6.0 - /usr/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
npmPackages:
react: ^16.6.1 => 16.6.1
react-native: ^0.57.7 => 0.57.7
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7

@MSSPL-PiyaleeMaiti This is not a react-native issue. It is caused by some wrong operation by jcenter and google and react native can do nothing on this. You need to check the link mentioned by hramos above.

@sunnylqm Is it solve by google and jcenter?

They are working on this. Check the link above.

I solve this issue by following steps from below link:
https://github.com/DylanVann/react-native-fast-image/issues/366#issuecomment-446203099

Now build is successful. But app is crash on launch.
My Package.json file is below:

{
  "name": "myproject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "analytics-react-native": "^1.2.0",
    "appcenter": "~1.8.1",
    "appcenter-analytics": "~1.8.1",
    "appcenter-crashes": "~1.8.1",
    "emojione": "~4.0.0",
    "react": "^16.6.1",
    "react-native": "^0.57.7",
    "react-native-af-video-player": "~0.1.9",
    "react-native-animatable": "~1.3.0",
    "react-native-app-link": "~1.0.0",
    "react-native-auth0": "~1.2.2",
    "react-native-auto-height-image": "~1.0.5",
    "react-native-code-push": "~5.3.2",
    "react-native-communications": "~2.2.1",
    "react-native-device-info": "~0.21.5",
    "react-native-drawer": "~2.5.0",
    "react-native-fast-image": "^5.1.1",
    "react-native-fcm": "~14.1.3",
    "react-native-google-places-autocomplete": "~1.3.6",
    "react-native-highlight-words": "~1.0.1",
    "react-native-html-parser": "0.0.5",
    "react-native-image-pan-zoom": "^2.1.11",
    "react-native-image-picker": "^0.27.2",
    "react-native-image-progress": "^1.1.1",
    "react-native-looped-carousel": "^0.1.13",
    "react-native-maps": "^0.15.3",
    "react-native-mentions": "^1.1.4",
    "react-native-modal-dropdown": "^0.6.2",
    "react-native-render-html": "^3.9.3",
    "react-native-vector-icons": "^6.1.0",
    "react-native-video": "^2.0.0",
    "react-native-video-player": "^0.9.1",
    "react-navigation": "^1.5.10",
    "rn-fetch-blob": "^0.10.13",
    "socket.io": "^2.1.1",
    "socket.io-client": "^2.1.1",
    "string-replace-to-array": "^1.0.3",
    "truncate-html": "^1.0.0"
  },
  "devDependencies": {
    "babel-jest": "22.4.3",
    "babel-preset-react-native": "4.0.0",
    "eslint": "~4.19.1",
    "eslint-plugin-react": "~7.8.2",
    "jest": "22.4.3",
    "npm-check": "~5.7.1",
    "react-test-renderer": "~16.3.0-alpha.1"
  },
  "jest": {
    "preset": "react-native",
    "setupFiles": [
      "./node_modules/appcenter/test/AppCenterMock.js",
      "./node_modules/appcenter-analytics/test/AppCenterAnalyticsMock.js",
      "./node_modules/appcenter-crashes/test/AppCenterCrashesMock.js",
      "<rootDir>/node_modules/appcenter/test/AppCenterMock.js",
      "<rootDir>/node_modules/appcenter-analytics/test/AppCenterAnalyticsMock.js",
      "<rootDir>/node_modules/appcenter-crashes/test/AppCenterCrashesMock.js"
    ]
  }
}

Is there any issue for lauching app.

Was this page helpful?
0 / 5 - 0 ratings