Error: Missing app.json. error in Expo XDE - react-native

I have developed an app using React-native, now i converted to expo using exp convert. I did all the changes to folder which is need (by following steps in expo-next-steps.txt) but when i run project on expo XDE, i am getting error like
Error: Missing app.json. How to solve this problem? and i used local push notification in react-native app. But in project structure there is file called app.json, still getting this error. i am new to expo, anyone please help me out.

The expo XDK looks for the expo SDK version in the app.json file. Thus, your app.json should look something like :
{
"name": "MyAPP",
"displayName": "MyAPP",
"expo": {
"sdkVersion": "18.0.0"
}
}
Replace the "18.0.0" with your SDK version.
Such error emerges when you create the app using
react-native init
instead of
create-react-native-app
I perceive this as one of the reasons. There may be more such explanations to such occurrences.Happy coding!

I deleted the app.json, restarted and it works in my setup.
You might rename it simply to app.json.orig

Related

Why does my Expo app run in Expo Go but not as a development build?

I've created a development build of an Expo app using EAS. Previously I would open the app in Expo Go by running npx expo start and scanning the Metro Bundler QR code.
Now, when I try to do the same thing, Expo Go asks whether I want to open the project in Expo Go or as a "Development Build". It works fine in Expo Go, but crashes immediately when I attempt to open the dev build. The error reads:
null is not an object (evaluating '_ReanimatedModule.default.createNode')
This error is suspiciously similar to one that I encountered earlier in development, which I resolved by downgrading to React Native version 0.69.6. I'm also encountering a second error that says "'main' has not been registered", but I suspect this is downstream of the first error.
I have the same issue when I try to run the app with npx expo start --dev-client.
Any ideas why I might be having this problem?
It sounds like you may have run expo prebuild (https://docs.expo.dev/workflow/prebuild/) which removes "main": "node_modules/expo/AppEntry.js", from app.json. Try to create a new expo app and look at it's app.json file.
When you run expo prebuild it changes a few things with your project (see "side effects" in the prebuild docs).
I'm actually working through some issues with that right now too. I thought I had to run prebuild but turns out I didn't have to. Ever since I ran it my app will not load via the dev-client way. I can however switch back to npx expo start (NOT npx expo start --dev-client, see the scripts section of app.json as that is also changed when prebuild is run).
Let me know if you are able to get your app to load after re-adding the main stuff to app.json.
Ps, are you by chance using react-native-google-mobile-ads?

React native: Device has no app to handle URI

I'm new to react native. I'm familiar with react.
I'm using Expo. Running npm start and then running iOS simulator from the menu has been working just fine until recently. When running npm start, console prints something like:
Metro waiting on exp+jorato://expo-development-client/url=http%3A%2F%2F192.168.1.129%3A8081
Previously this was a different url like:
Metro waiting on exp://192.168.1.129:8081
After it has changed to this long url, when trying open the iOS simulator, i get this error:
› Opening on iOS...
› Opening exp+jorato://expo-development-client/?url=http%3A%2F%2F192.168.1.129%3A8081 on iPhone 13
Device iPhone 13 (B7D52679-208F-49F2-8FF6-9E2CC4A47073) has no app to handle the URI: exp+jorato://expo-development-client/?url=http%3A%2F%2F192.168.1.129%3A8081
"jorato" comes from my app.json setting frome "scheme" under "expo":
"expo": {
"name": "Jorato",
"slug": "jorato",
"version": "1.0.0",
"scheme": "jorato",
...
I've been searching for documentation of where this url comes from with no luck. Anyone who could point me in right direction would be much appreciated.
Update: Found https://docs.expo.dev/development/development-workflows/, which defines that deep links use:
{scheme}://expo-development-client/?url={manifestUrl}
URL scheme of your client (defaults to exp+{slug} where slug is the value set in your app.json)
This seems consistent with what i'm getting. So must be something else that's the problem.
It seems that combined with the knowledge gained here https://docs.expo.dev/development/development-workflows/ that the problem is related to having a prior ios build and then that being deleted but not being done correctly. I've made a new build and am no longer getting this issue. Not completely sure what the reason was.

Switch from Expo to bare React native

After giving the command expo build:android to generate .apk file for my project. The size of the app was too big (60MB). So, I went through certian websites, Most of them are showing that I need to eject expo and generate an apk in bare react-native-cli. Is there any method to reduce the size of an expo app? or should I go with bare react-native-cli. If it is a yes, can you provide steps to achieve this?
Cross answering from here. In your app.json make the following changes
"expo": {
...
"android": {
"enableDangerousExperimentalLeanBuilds": true
}
}
And you can use
expo build:android -t app-bundle
This will create an Android Application Bundle which is a publishing format.

react-native bundling failed Invalid call error when using 3rd party library

I wrote a React app which used a 3rd party library and had no issues. I am now trying to write the equivalent app in React-Native (as a learning exercise) and I am running into an error as soon as I try and call an API in the 3rd party library.
I am on a windows machine and have react versions
"react": "16.9.0",
"react-native": "0.61.5",
Error
The error I am seeing in the window showing the metro builder has
error: bundling failed: src\scripts\my3rdPartyLib.js: src\scripts\my3rdPartyLib.js:Invalid call at line 121:
require([something], function (....
In my Android emulator I am seeing
The development server returned response error code : 500
Note: It also fails if i have the library coming from node-modules as apposed to copying it into my "scripts" folder.
What I have tried
As per a thread on SO i uninstalled babel-preset-react-native and then installed it.
npm un -D babel-preset-react-native
npm i -D babel-preset-react-native#2.1.0
Afterwards I realised as I am on version 61 it uses "metro-react-native-babel-preset", my babel.config.js contains the following
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
};
Does anyone have an idea how I can get the use of the 3rd party library working in my react-native app?
After Googling, it is my understanding that React Native uses the metro bundler which doesn't seem to support dynamic require().
https://github.com/facebook/metro/issues/52
React Native: require() with Dynamic String?
Further investigation into the library that i am trying to use, i see that it is expecting to either be run in the browser or a Node environment. For ReactNative this is not the case, therefore I believe I can not use this library in my application.

Created an app with create-react-native-app, how to publish it to the Google Play Store?

I have created an app with create-react-native-app, but I am not sure how to publish it to google play store.
Error 1
After reading this doc.
; exp build:android
[exp] Making sure project is set up correctly...
/[exp] Warning: Not using the Expo fork of react-native. See https://docs.expo.io/.
\[exp] Warning: 'react-native' peer depencency missing. Run `npm ls` in /var/www/html/test/testme/osmosis-seek-android to see full warning.
[exp]
[exp] If there is an issue running your project, please run `npm install` in /var/www/html/test/testme/osmosis-seek-android and restart.
[exp] Your project looks good!
[exp] Checking if current build exists...
[exp] No currently active or previous builds for this project.
? Would you like to upload a keystore or have us generate one for you?
If you don't know what this means, let us handle it! :)
false
[exp] Starting build process...
[exp] Publishing...
[exp] Published
[exp] Your URL is
https://exp.host/#kenpeter/osmosis-seek-android
[exp] Building...
[exp] Must specify a java package in order to build this experience for Android. Please specify one in app.json at "expo.android.package"
With projects created using create-react-native-app you have two paths to the Google Play Store.
Use the Expo exp build command
One path is to use the Expo (a project I work on) exp command-line tool to build the APK. The exp command-line tool (and XDE GUI program) can load projects created with CRNA. After getting set up, you can run exp build:android and receive an APK in a few minutes.
The first time you do this, you'll have to add some information to expo.json or app.json (whichever you have) that's required for the APK. Specifically you need to specify the Java package name like this (it's important it's a valid Java package name!):
{
android: {
package: "com.example.myapp"
}
}
These are the docs that talk about building an APK (and IPA for iOS): https://docs.expo.io/versions/latest/guides/building-standalone-apps.html
Eject and build an APK manually
Another path is to use CRNA's eject command, which creates Xcode and Android project files for you. Then you'd create an APK and submit it to the Play Store like any other React Native Android app. One of the downsides of this approach is that after you've ejected from CRNA, you don't get to use CRNA's tools and it won't take care of upgrades for you in the future.
{
"expo": {
"sdkVersion": "26.0.0",
"name": "TongPos",
"description": "your app desc",
"android": {
"package": "com.sohagfaruque.xxxx"
}
}
}
Please edit your app.json like above mentioned. That worked for me.