I use react native 66 when run yarn android got the Error
yarn run v1.22.17
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1428 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...
Configure project :react-native-firebase
react-native-firebase: using React Native prebuilt binary from /Users/ha3an/Documents/Bahrami/phone/homeserviceuser/node_modules/react-native/android
WARNING:: The specified Android SDK Build Tools version (28.0.3) is ignored, as it is below the minimum supported version (30.0.2) for Android Gradle Plugin 4.2.2.
Android SDK Build Tools 30.0.2 will be used.
To suppress this warning, remove "buildToolsVersion '28.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Task :app:checkDebugAarMetadata FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
39 actionable tasks: 2 executed, 37 up-to-date
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.android.volley:volley:1.1.1.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/android/volley/volley/1.1.1/volley-1.1.1.pom
- file:/Users/ha3an/.m2/repository/com/android/volley/volley/1.1.1/volley-1.1.1.pom
- file:/Users/ha3an/Documents/Bahrami/phone/homeserviceuser/node_modules/react-native/android/com/android/volley/volley/1.1.1/volley-1.1.1.pom
- file:/Users/ha3an/Documents/Bahrami/phone/homeserviceuser/node_modules/jsc-android/dist/com/android/volley/volley/1.1.1/volley-1.1.1.pom
- https://dl.google.com/dl/android/maven2/com/android/volley/volley/1.1.1/volley-1.1.1.pom
- https://www.jitpack.io/com/android/volley/volley/1.1.1/volley-1.1.1.pom
Required by:
project :app > project :react-native-google-places > com.google.android.libraries.places:places:1.1.0
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 25s
and build.qradle file is
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
classpath("com.google.gms:google-services:4.3.10")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
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()
maven { url 'https://www.jitpack.io' }
}
}
i try use jcenter on my build.gradle file it's build successfully but got error
Error: ENOENT: no such file or directory, open '/.../phone/homeserviceuser/http:/localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.aloosalamati.homeserviceuser&modulesOnly=false&runModule=true'
at Object.openSync (node:fs:585:3)
at Object.readFileSync (node:fs:453:35)
at getCodeFrame (/.../phone/homeserviceuser/node_modules/metro/src/Server.js:919:18)
at Server._symbolicate (/.../phone/homeserviceuser/node_modules/metro/src/Server.js:992:22)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Server._processRequest (/.../phone/homeserviceuser/node_modules/metro/src/Server.js:403:7) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/.../phone/homeserviceuser/http:/localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.aloosalamati.homeserviceuser&modulesOnly=false&runModule=true'
}
i google it but can not find any solution for it
This worked for me.
Added these lines in project gradle all projects section
jcenter() //by adding this
google()
maven { url 'https://www.jitpack.io' }
maven {
url "https://maven.google.com" // by adding this
}
Full code
allprojects {
repositories {
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")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
jcenter()
google()
maven { url 'https://www.jitpack.io' }
maven {
url "https://maven.google.com" // specifically this worked
}
}
}
i use jcenter and it's work fine
Related
I am trying to run my app, but when running npx react-native run-android, I get the following error.
``
Task :app:dataBindingMergeDependencyArtifactsDebug FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
3 actionable tasks: 2 executed, 1 up-to-date
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:dataBindingMergeDependencyArtifactsDebug'.
Could not resolve all files for configuration ':app:debugCompileClasspath'.
Could not resolve org.tensorflow:tensorflow-lite:+.
Required by:
project :app
> Skipped due to earlier error
Could not resolve org.tensorflow:tensorflow-lite-metadata:+.
Required by:
project :app
> Skipped due to earlier error
Could not resolve org.tensorflow:tensorflow-lite-task-vision:+.
Required by:
project :app
> Skipped due to earlier error
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 2m 8s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
``
android > build.gradlew
buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 30
// ndkVersion = "20.1.5948944"
ndkVersion = "23.1.7779620"
}
repositories {
google()
jcenter()
}
dependencies {
// classpath("com.android.tools.build:gradle:4.1.0")
// classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.google.gms:google-services:4.3.3'
// classpath("com.android.tools.build:gradle:3.5.3")
classpath("com.android.tools.build:gradle:4.1.0")
// 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")
}
maven {
// expo-camera bundles a custom com.google.android:cameraview
url "$rootDir/../node_modules/expo-camera/android/maven"
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
What can i do?
I have created a boilerplate react-native application and then trying to add react-navigation to it. However the moment I add dependencies for "react-native-safe-area-context": "^4.2.5", I started getting following error in my build:
yarn run v1.22.10
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1379 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...
> Configure project :react-native-safe-area-context
[Fatal Error] semver4j-0.16.4.pom:2:1: Content is not allowed in prolog.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':react-native-safe-area-context'.
> Could not resolve all artifacts for configuration ':react-native-safe-area-context:classpath'.
> Could not resolve com.github.gundy:semver4j:0.16.4.
Required by:
project :react-native-safe-area-context > org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10
> Could not resolve com.github.gundy:semver4j:0.16.4.
> Could not parse POM https://repo.maven.apache.org/maven2/com/github/gundy/semver4j/0.16.4/semver4j-0.16.4.pom
> Content is not allowed in prolog.
I am not sure what exactly is causing this issue as I am still using mostly the standard boilerplate code.
My build.gradle looks like below:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
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()
maven { url 'https://www.jitpack.io' }
}
}
Strange! but it was issue with my internet connection
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1345 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...
FAILURE: Build failed with an exception.
Where:
Build file 'D:\workspace\HS\ParkCheck\parkcheck-android-app-master\android\app\build.gradle' line: 1
What went wrong:
A problem occurred evaluating project ':app'.
Failed to apply plugin 'com.android.internal.version-check'.
Minimum supported Gradle version is 6.7.1. Current version is 6.7. If using the gradle wrapper, try editing the distributionUrl in D:\workspace\HS\ParkCheck\parkcheck-android-app-master\android\gradle\wrapper\gradle-wrapper.properties to gradle-6.7.1-all.zip
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 4s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Please help me.
I cant build my project.
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:4.1.0")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
// Add the following line:
// classpath 'com.google.gms:google-services:4.3.3' // Google Services plugin
}
}
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 need to build and run a project, I cloned it, install dependencies and after I run the command yarn android, build fails and console tell me this:
info Installing the app...
Starting a Gradle Daemon, 3 incompatible and 1 stopped Daemons could not be reused, use --status for details
Configuration on demand is an incubating feature.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> You must specify a URL for a Maven repository.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3m 21s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
error Command failed with exit code 1.
I checked the line that says "You must specify a URL for a Maven repository." and find out the build.gradle file should contain a Maven URL but mine already has the URL:
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
buildscript {
ext {
firebaseMessagingVersion = "21.1.0"
minSdkVersion = 23
compileSdkVersion = 29
targetSdkVersion = 29
buildToolsVersion = "29.0.2"
googlePlayServicesVersion = "17.0.0"
multiDexEnabled=true
supportLibVersion = "23.1.1"
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
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")
}
jcenter()
maven {
url 'https://jitpack.io'
url "https://maven.google.com"
}
maven {
url = properties.getProperty ("bkm_maven_url")
credentials {
username = properties.getProperty ("bkm_username")
password = properties.getProperty ("bkm_password")
}
}
// force dependency versions on all subprojects
configurations.all {
resolutionStrategy {
// use 0.9.0 to fix crash on Android 11
force "com.facebook.soloader:soloader:0.9.0"
}
}
}
}
how can I solve this issue?
after testing different ways I figure out that I should only use npm to install dependencies. I mean don't mix with yarn and this solved my issue.
I am new to React native trying to start a new project. I followed google docs and already had the android studio installed. added ANROID_HOME to env variables and platform tools to system variables as mentioned in the docs. while running ```react-native run-android``. I get this error
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'AwesomeProject'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:3.4.2.
my android studio version plugin is 3.4.2 and here is my build.gradle file :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.2")
// 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://jitpack.io' }
}
}
and my gradle-wrapper.properties file
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Thanks all for the Answers I think I will provide the answer here for others to use.
my issue was due to the version conflict of gradle and android studi plugin.
1- open android studio and start a new project
2- There should be a builde.gradle and gradle wrapper file
3- the versions you see for gradle here for e.g 5.1.1 or etc is the version you must use in your project**
4- change the classpath com.android.tools.build:gradle:to 3.4.2 in your project build.gradle file
5- change the gradle wrapper properties distribution path to distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip