I have been used vector icons in my react native projects and it was well done,but before some hours while doing the build (react-native run-android) for android platform I get this error.
Did these steps to add vector Icons:
npm install react-native-vector-icons –save
react-native link
Can anyone help to resolve this issue?
FAILURE: Build failed with an exception.
* 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
* 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 7s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Add this to build.gradle
These issue is because these package are released for some period.
It can solve the issue of image-picker and vector-icons
subprojects {
if (project.name.contains('react-native-image-picker') ||
project.name.contains('react-native-vector-icons')) {
buildscript {
repositories {
jcenter()
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
}
}
Related
I have a problem with building react native app on android emulator. I tried to crate app with Expo and everything works great on android device, android emulator(Android studio) and web. But when I try to create with React Native CLI a have a build error.
admin#users-MacBook-Pro secondProjectReactNative % npx react-native run-android
warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
info Starting JS server...
/bin/sh: adb: command not found
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
5 actionable tasks: 5 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/admin/secondProjectReactNative/android/local.properties'.
* 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 3s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/admin/secondProjectReactNative/android/local.properties'.
* 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 3s
at makeError (/Users/admin/secondProjectReactNative/node_modules/execa/index.js:174:9)
at /Users/admin/secondProjectReactNative/node_modules/execa/index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (/Users/admin/secondProjectReactNative/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/admin/secondProjectReactNative/node_modules/#react-native-community/cli/build/index.js:142:9)
info Run CLI with --verbose flag for more details.
What can be wrong? Thanks a lot.
I did everything what was in react native CLI quick start https://reactnative.dev/docs/next/environment-setup
I'm sure that PATH is added
admin#users-MacBook-Pro secondProjectReactNative % echo $PATH
/Users/admin/.rvm/gems/ruby-2.7.5/bin:/Users/admin/.rvm/gems/ruby-2.7.5#global/bin:/Users/admin/.rvm/rubies/ruby-2.7.5/bin:/Users/admin/.rvm/bin:/usr/local/opt/ruby#2.7/bin:/usr/local/opt/ruby#2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/local/opt/ruby#2.7/bin:/Users/admin/Library/Android/sdk/tools:/Users/admin/Library/Android/sdk/platform-tools:/Users/admin/Library/Android/sdk/emulator:/Users/admin/Library/Android/sdk/platform-tools
I downloaded SDK through Android Studio.
Start android studio emulator before "run android" doesn't help.
I am working on a React-Native project using Unity (asmadsen/react-native-unity-view). The code is working properly on both Android and iOS and build is also being generated for both the platforms respectively. But now I am trying to make the build through Appcenter for Android doing all the necessary setup process but it's failing all the time. But when I am doing the same for a demo React-Native project, the build is successful on the Appcenter.
The error logs as found on the Appcenter is :
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/runner/work/1/s/android/UnityExport/unityLibrary/build.gradle' line: 66
* What went wrong:
Execution failed for task ':UnityExport:BuildIl2CppTask'.
> Location specified by ndk.dir (/Applications/Unity/Hub/Editor/2020.3.16f1/PlaybackEngines/AndroidPlayer/NDK) did not contain a valid NDK and couldn't be used
* 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 56s
Can anyone has any idea and help me over the same. Thanks in advance.
It's seem that you haven't valid NDK on your computer, for unity 2018 you must install android-ndk-r16b and for unity 2020 you must install android-ndk-r19.
depend on your OS and unity version download and install valid NDK from NDK.
React Native: 0.62.0
react-native-camera: git+https://git#github.com/react-native-community/react-native-camera.git
My app runs fine using react-native run-android but when I try to generate the .apk it fails with the following error
Error Message:
FAILURE: Build failed with an exception.native-camera:mlkitReleaseCompileClasspath > Resolve dependencies of :react-native-camera:mlkitReleaseRu
* What went wrong:
Could not determine the dependencies of task ':react-native-camera:compileMlkitReleaseJavaWithJavac'.
Could not resolve all task dependencies for configuration ':react-native-camera:mlkitReleaseCompileClasspath'.
Could not find com.google.firebase:firebase-ml-vision:12.0.1.
Required by:
project :react-native-camera
Could not find com.google.firebase:firebase-ml-vision-face-model:12.0.1.
Required by:
project :react-native-camera
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
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.0.1/userguide/command_line_interface.html#sec:command_line_warnings
While trying to run the react-native application on android emulator, getting the following error. Please note the android emulator is already running.
A problem occurred configuring root project 'MyReactNativeApp'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.0.1.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.0.1.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools
/build/gradle/3.0.1/gradle-3.0.1.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build
/gradle/3.0.1/gradle-3.0.1.pom'.
> jcenter.bintray.com
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Any help will be much appreciated.
The solution was simple. All I did was upgraded react-native and it solved the problem.
react-native upgrade
Following the tutorial here, I am unable to run the app in the emulator. When I execute the react-native run-android command from the DOS prompt, here is the error I get:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'AwesomeProject'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:2.2.3.
Required by:
:AwesomeProject:unspecified
> Could not resolve com.android.tools.build:gradle:2.2.3.
> Could not get resource 'https://repo1.maven.org/maven2/com/android/to
ols/build/gradle/2.2.3/gradle-2.2.3.pom'.
> Could not GET 'https://repo1.maven.org/maven2/com/android/tools/bu
ild/gradle/2.2.3/gradle-2.2.3.pom'.
> repo1.maven.org
> Could not resolve com.android.tools.build:gradle:2.2.3.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools
/build/gradle/2.2.3/gradle-2.2.3.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build
/gradle/2.2.3/gradle-2.2.3.pom'.
> jcenter.bintray.com
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
Things I tried:
Editing build.gradle file and changing classpath from classpath 'com.android.tools.build:gradle:2.2.3' to com.android.tools.build:gradle:3.3.0' (the version I have installed with Android Studio).
Verified that jcenter() is listed as a repository in build.gradle under both buildscript and allprojects
Try setting it to 2.3.0
Strange, I can't see any 2.2.3 in that path but I can see a 2.3.0
http://repo1.maven.org/maven2/com/android/tools/build/gradle/
I recreated the project using the react-native cli, and the issue seemed to correct itself. I should note that I believe I had not installed android studio when I initially created the project, so maybe that had something to do with it, not sure.