12

I am coding with React Native. I don't see that when I first create react-native app for check running. When I implements my code see that. My purpose is generate apk.

enter image description here


Solved

Result: I solved my problem with npm install. I would like say many month after.

Community
  • 1
  • 1
Mert Ekinci
  • 123
  • 1
  • 1
  • 8

5 Answers5

7

If anyone's getting this error after upgrading Expo, try restarting your simulator - that fixed it for me.

yndolok
  • 5,197
  • 2
  • 42
  • 46
3

Here is my experience if someone using expo sees those error message.

I accidentally installed expo manually in my project which was version 29.0.0.

I was using version 28.0.0 of expo sdk, so it may have crashed inside.

What I did:

  1. manually upgrade sdkVersion of app.json to 29.0.0.
  2. change sdk version to 29.0.0 for react-native.
Gompro
  • 2,247
  • 1
  • 16
  • 26
  • Just had exactly this problem: I had upgraded to 29.0.0 in package.json, but not app.json. (app.json really should read from package.json...) – Robert Fischer Sep 05 '18 at 14:12
3

Had exactly the same error - fresh machine, fresh npm, only one version of expo installed.

Turns out, expo requires you to build it as an app before it can send it to the expo app properly (at least on Android). This is easiest done by:

  • Adding an "android" section to app.json, with the contents "package": "uk.co.yourcompany.yourpackagename" (this is required by android packages. It can be complete garbage, but should follow that format - a backwards domain name)
  • running expo build:android and following the instructions to sign up to expo's servers and build the app
  • then restarting expo start

Not sure if this is documented anywhere though, so may be a new thing?

Another thing to try is to move your node_modules folder away (or maybe delete it, up to you) and re-run npm install

user208769
  • 2,216
  • 1
  • 18
  • 27
1

According to the official tutorial: https://facebook.github.io/react-native/blog/2017/03/13/introducing-create-react-native-app.html

If you want to use expo in your application, you must create it in the following way

npm i -g create-react-native-app create-react-native-app my-project cd my-project npm start

This will start the React Native packager and print a QR code. Open it in the Expo app to load your JavaScript.

as I see your code has files that are not necessary, such as build.gradle and index.js, the structure that create-react-native-app creates is different and easier to use

jerson
  • 345
  • 4
  • 10
  • 2
    Thank your feedback but I don't wanna use expo. I am trying Android Studio for generate apk. I search but I didn't find a result for my problem. Do you suggest any tag, concept, type for learn? I tried react native generating apk of offical document. – Mert Ekinci Jan 18 '18 at 18:18
0

I was getting the same error after updating the expo-cli to version 3.0.6.

By looking at my package.json I noticed the expo-cli version installed on my computer is not the same as package.json. so I changed it to "expo-cli": "^3.0.6" and ran npm install || yarn, then the error disappeared!

Reza Shoja
  • 887
  • 2
  • 11
  • 24