please somebody help me on this
i made a react native project with the command line react-native init and when i wanna open test it while my android emulator is open and i run it with the command line react-native run android i get this messege
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:2.3.3.
Required by:
project :
Could not resolve com.android.tools.build:gradle:2.3.3.
Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.3.3/gradle-2.3.3.pom'.
Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.3.3/gradle-2.3.3.pom'.
Connect to jcenter.bintray.com:443 [jcenter.bintray.com/5.153.35.248] failed: Connection timed out: connect
i try everthing to fix it but nothing happened
open folder android in your project folder
in which you can find build.gradle open this file
at the and of the file you can find
allprojects {
repositories{
...
}
}
add google() in to it like this
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
Related
i got a bug when i build react native apk. last week I built no error. but now an error occurs, even though there is no new package that I installed.
Task :react-native-async-storage_async-storage:generateReleaseRFile FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-async-storage_async-storage:generateReleaseRFile'.
> Could not resolve all files for configuration ':react-native-async-storage_async-storage:releaseCompileClasspath'.
> Failed to transform react-native-0.71.0-rc.0-release.aar (com.facebook.react:react-native:0.71.0-rc.0) to match attributes {artifactType=android-symbol-with-package-name, com.android.build.api.attributes.BuildTypeAttr=release, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-api}.
> Could not find react-native-0.71.0-rc.0-release.aar (com.facebook.react:react-native:0.71.0-rc.0).
Searched in the following locations:
https://repo.maven.apache.org/maven2/com/facebook/react/react-native/0.71.0-rc.0/react-native-0.71.0-rc.0-release.aar
i wish i could build apk
hope this can help you [FIXED] Android build failures No matching variant of com.facebook.react:react-native:0.71.0-rc.0 was found
in my case it was because of using maven's react native version how I fixed it.
android/build.gradle
mavenCentral()
jcenter()
exclusiveContent {
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central
as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }
Recently Android Studio was kind enough to offer to upgrade to gradle 6.5.
Naive I was: I clicked yes, then the new upgrade occured and now everytime I build I get this error similar to:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
> A problem occurred configuring project ':react-native-fs'.
> Could not resolve all artifacts for configuration ':react-native-fs:classpath'.
> Could not find com.android.tools.build:gradle:4.1.1.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/4.1.1/gradle-4.1.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project :react-native-fs
my android/build.gradle file has those lines:
buildscript {
repositories {
mavenLocal()
google()
jcenter()
maven { url "$rootDir/../node_modules/react-native/android" }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.google.gms:google-services:4.0.1'
}
}
So life's good for my project, but not for A LOT of modules, which have this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
}
}
To solve the issue, I need to add the google() repository.
... but I don't like manually editing any file under the node_modules/ folder as any new install with break them.
Is there a way to fix this ?
Just delete node_modules folder and run
yarn install
or
npm install
reopen project in Android Studio and thats it
I created a new react native project and ran react-native run-android.
However, I am getting this error:
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Here's the screenshot:
Here's my android/build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
I am new with react native and this is a new project so any help will be appreciated.
Solution-1: The problem was resolved by deleting and re-creating the AVD (Android Virtual Device) file. The AVD can be deleted from Android Studio. It is usually saved at C:\Users\<userName>\.android\avd
Most likely, you also need to execute the following commands.
cd <project_filder>
cd android
gradlew clean
In case you did not notice the comments on the question (above), please check them out. They include more suggestions, which might be relevant to the problem.
1st Update:
Solution-2: In some other instance, in addition to deleting and re-creating the AVD, I had to do the following steps.
REM 1. Removing cache files
rd %localappdata%\Temp\metro-cache /s /q
del %localappdata%\Temp\haste-map*
REM 2. Cleaning Gradle files
cd <project_filder>
cd android & gradlew clean & cd ..
REM 3. Deleting node_modules
rd node_modules /q /s
REM 4. Cleaning npm cache
npm cache clean --force
REM 5. Re-installing npm modules
npm install
2nd Update:
Solution-3: In a 3rd instance, I had to add the following line in the file <proj-folder>/android/gradle.properties
org.gradle.jvmargs=-Xmx4608m
Worth noting I encountered this in a native (Kotlin) Android project.
For me this was caused by having densities specified in my resConfigs:
build.grade (:app)
developLint {
dimension "version"
resConfigs "en", "he-rIL", "iw-rIL", "xxhdpi"
}
(Note the "xxhdpi" above)
Removing the density solved the problem.
What went wrong:
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugApk'.
A problem occurred configuring project ':react-native-spinkit'.
Could not resolve all dependencies for configuration ':react-native-spinkit:classpath'.
Could not resolve com.android.tools.build:gradle:2.0.0.
Required by:
Myproject:react-native-spinkit:unspecified
Could not resolve com.android.tools.build:gradle:2.0.0.
Could not get resource 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.0.0/gradle-2.0.0.pom'.
Could not HEAD 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.0.0/gradle-2.0.0.pom'. Received status code 403 from server: Forb
idden
android/build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
url "https://maven.google.com"
}
// Add jitpack repository (added by react-native-spinkit)
maven { url "https://jitpack.io" }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
The issue seems to be related to the version not supported com.android.tools.build:gradle:2.2.3.
You can try two thing here -
1) upgrade the versions to latest and try to build again.
2) Try to change version as given below to check if its working with version 2.0.0 or not
classpath 'com.android.tools.build:gradle:2.2.3'
with
classpath 'com.android.tools.build:gradle:2.0.0'.
Hope it solves your problem !
Can someone help me with this error?
FAILURE: Build failed with an exception.
What went wrong:
Could not resolve all files for configuration ':react-native-google-signin:debugCompileClasspath'.
Could not find play-services-auth.jar (com.google.android.gms:play-services-auth:12.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-auth/12.0.1/play-services-auth-12.0.1.jar
Try to replace your android/build.gradle with this i.e in your project level gradle with this
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// 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"} //<---- this should be added and should be aboce jcenter
maven {url "$rootDir/../node_modules/react-native/android"}
jcenter()
}
}
After that clear your gradle going inside android folder from cmd/terminal
gradlew clean
Then run the react native application