1
votes

[x] submitting bug

[x] Android platform react-native

[x] ubuntu 16.04 LTS

I am having issue in creating build by command react-native run-android

Here i am pasted error:

$ react-native run-android Scanning folders for symlinks in /home/pct3/webroot/Hello/node_modules (39ms) JS server already running. Building and installing the app on the device (cd android && ./gradlew installDebug)...

FAILURE: Build failed with an exception.

BUILD FAILED in 12s 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

Your help will save my day, if you need any extra information let me know.

Github link: Issue

3
"Make sure you have an Android emulator running or a device connected and have set up your Android development environment: facebook.github.io/react-native/docs/getting-started.html" <-- did you do this?Ishita Sinha
a Gradle issue, you can delete Gradle build folder android/.gradle and rebuild project.Android Team
@IshitaSinha yes i have setup Android development, i am using genemotion as emulator, adb devices command also display that emulator as running.Chirag Thaker
One thing i found weired that, app is runnig when run from android studio, but error of gradle when typing command react-native run-androidChirag Thaker
@AndroidTeam Tried but does not solving errorChirag Thaker

3 Answers

1
votes

a fast and easy solution to this issue is as following

1- open android/build.gradle 2-replace the gradle version with an older one for example 3.0.1

example of how it should look

classpath("com.android.tools.build:gradle:3.0.1")

and boom no more issues

0
votes

Delete or rename the android folder and run react-native upgrade command.

0
votes

Run npm install

Change your build.gradle so it follows this format:

You can see all available artifacts at Google's Maven repository index (see below for programmatic access). To add one of these libraries to your build, include Google's Maven repository in your top-level build.gradle file:

allprojects {
  repositories {
      google()

    // If you're using a version of Gradle lower than 4.1, you must instead use:
    // maven {
    //     url 'https://maven.google.com'
    // }
    // An alternative URL is 'https://dl.google.com/dl/android/maven2/'
 }
}

More info here https://developer.android.com/studio/build/dependencies