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.
Related
Problem facing in the android app setup with error
1: Task failed with an exception.
-----------
* Where:
Build file '/Users/rover/Desktop/appflow/node_modules/react-native-static-server/android/build.gradle' line: 23
* What went wrong:
A problem occurred evaluating project ':react-native-static-server'.
> Plugin with id 'maven' not found.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':react-native-static-server'.
> com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle
I am getting this error on android while installing the app on the emulator. Checked with some online answers but not able to resolve it.
Basically it is not good solution, but you can go inside of node modules and find your package, after open android folder and do the next instead of using:
apply plugin: 'maven'
you should use
apply plugin: 'maven-publish' and it will solve error. I will not recommend to do so, but it might help. Enjoy
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/" }
}
}
}
}
I have been trying to get Storybook 3.4.4 to work with react 0.57. I have recently upgraded from 0.55.4 where things seemed to be fine.
I have also upgraded to babel 7 using the babel-upgrade tool.
Now when i try to run my Storybook...
storybook start -p 7007
react-native run-android
i get the following error...
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugApk'.
A problem occurred configuring project ':react-native-vector-icons'.
Could not resolve all dependencies for configuration ':react-native-vector-icons:_debugPublishCopy'.
Could not find com.android.support:appcompat-v7:27.1.1.
Searched in the following locations:
file:/Users/[XXX]/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.pom
file:/Users/[XXX]/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.jar
file:/Users/[MY PROJECT LOCATION]/android/sdk-manager/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.jar
Required by:
boilerplate:react-native-vector-icons:unspecified > com.facebook.react:react-native:0.57.0
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 9.08 secs
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
Can anyone help me out please?
If storybook start -p 7007 runs fine, the issue is not related to babel nor storybook.
From you stacktrace, your error must be coming from the build.gradle at the root of your project.
Make sure you have the right maven repository in your dependencies.
You should have a look at this issue: https://github.com/react-community/lottie-react-native/issues/343
File /Users/MyName/.android/repositories.cfg could not be loaded.
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugApk'.
A problem occurred configuring project ':urbanairship-react-native'.
Could not resolve all dependencies for configuration ':urbanairship-react-native:_debugPublishCopy'.
Could not find any version that matches com.facebook.react:react-native:[0.40,).
Versions that do not match:
0.20.1
0.20.0
0.19.1
0.19.0
0.18.0
+ 12 more
Required by:
Koopi Customer:urbanairship-react-native:unspecified
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 15.647 secs
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/android-setup.html
You are missing the repositories file:
touch ~/.android/repositories.cfg
I'm trying to get set up using https://github.com/brentvatne/react-native-video for an android version of a react-native app. After making all the changes to the various gradle files I'm running into this issue below.
I'm a bit of a novice with Android development, and I think I'm just making a silly mistake which is why I'm asking the question here rather than raising an issue. Any advice would be appreciated!
$ react-native run-android
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Cannot evaluate module RCTVideo : Configuration with name 'default' not found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 0.851 secs
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/android-setup.html
Edit, settings.gradle looks like this:
rootProject.name = 'app_name'
include ':RCTVideo', ':app'
project(':RCTVideo').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android')
Without seeing the Settings.gradle my guess would be that the project location isn't going into the folder that has the gradle for the android version of the library. I would recommend added /android at the end of the path if it isn't there already.
I will update this answer when the Settings.gradle is provided.
-- Edit after additional information provided --
The version available on NPM is from 3 months ago. It looks like they didn't start adding Android support till Oct 30th and have continued working on it. As such you likely don't actually have the Android code in your node_modules folder. You can either wait till they push an update to NPM or install directly from the git repo. If you go the route of installing directly from the git repo you might want to tag it with a specific commit so you don't keep getting the latest every time you do a npm install.