0

I have a error for running a android app like image below:

enter image description here

For package.json:

{
  "name": "Training",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.4.1",
    "react-native": "0.56.0"
  },
  "devDependencies": {
    "babel-jest": "23.4.2",
    "babel-preset-react-native": "5.0.2",
    "jest": "23.4.2",
    "react-test-renderer": "16.4.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

and the android/app/gradle.properties:

dependencies {
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    compile "com.facebook.react:react-native:+" // From node_modules
}

How can I resolve the problem?

Rudi Wijaya
  • 872
  • 1
  • 10
  • 25
  • Possible duplicate https://stackoverflow.com/questions/47763824/react-native-version-mismatch - try checking answers of this – Kirankumar Dafda Jul 30 '18 at 10:23
  • I have tried like 1. compile ("com.facebook.react:react-native:0.52.0") { force = true } 2. compile ("com.facebook.react:react-native:0.56.0") { force = true } 3. close all terminal + rebuild they are not works for me... @KirankumarDafda – Rudi Wijaya Jul 30 '18 at 10:47

2 Answers2

0
  1. Close all terminals (therefore stopping all running bundlers)
  2. optionally: clear caches
  3. optionally: to make sure your build uses the correct version you may run: ./gradlew androidDependencies and check the output which react native version your build actually uses (0.56 or 0.52)
  4. deinstall the app from the device and freshly reinstall it!
JimVanB
  • 1,215
  • 1
  • 13
  • 29
0

I resolved the problem by:

  1. Restart PC (linux mint 17.3)
  2. Wipe Data for the emulator
  3. And run final command: react-native run-android
Rudi Wijaya
  • 872
  • 1
  • 10
  • 25