Issue when building react-native app vie expo - react-native

I try to build react-native expo project..
!!! WORKING PERFECTLY ON SIMULATORS BOTH ANDROID AND IOS BUT NOT ON REAL DEVICE !!!
1.with eas build: -- when I download the builded .apk on a real device doesn't want to fetch any information I have error handling with alert ! And only the alert is showing
2.With expo build:android .. builds 20 minutes it says the build fails but still produce downloadable .apk when I download it on a real device now fetching works and we come to the point where the user must press a button and give permission to location to navigate to other screen where is map with directions from Google Directions API, but when you press the button and give permission its like the app freezes and won't navigate to the other screen...
ANY IDEAS ?

Related

Where can I source help for native crashes of an expo EAS apk build

I am building an app using react-native on Expo and making sure to build with EAS every few days or whenever I add a new dependency.
After every build, I install the apk on an Android device and run the ios build on a simulator.
On my latest build, the build completes successfully but after installing the apk on android 10, the app opens and crashes once I navigate to a certain page.
It works fine on 3 other android phones.
The code difference between the last successful build that doesn't crash to the current one is minimal however very necessary for the app.
How can I see logs from the native crash in order to find the cause of the problem and hopefully find a fix?
I tried to install sentry but at the bottom of the page, it explains it only follows js issues and is not native.
Any ideas will be helpful
Thanks

Hot reload using EAS

About a year ago, when I was using Expo to build react native apps, there were :-
hot reload
hosting to Expo build site, from where testers could download by scanning the QR code
run time errors display on emulator or connected device
When I revisited the app after a break of 1 year, I see that Expo is migrating to EAS (Expo Application Services). So, I ejected from Expo, and use 'eas build' .
Now I build using 'preview' profile, download the '.apk' from the EAS build site, drag it onto Android Emulator to test.
However, I don't see the above facilities of 'hot reload' and 'uploading to an Expo site for testers to download', or 'run time errors display on connected device'.
What is the alternative ? Should I go back to using react-native build ?
It a little easier to answer your question if there is only one question 🙂
However, I don't see the above facilities of 'hot reload' ..
Shaking the device should show a fast refresh option
..and 'uploading to an Expo site for testers to download'
You can use EAS updates together with the dev-client
eas update --branch testers --message "Feature A"
Shake device
"Go home"
Extensions
sign in (to an expo user that is connected to an organisation)
pick the updates to try out
or 'run time errors display on connected device'.
It should display the errors (it does that for me with the dev-client)
What is the alternative ? Should I go back to using react-native build ?
There aren't many great alternative to expo - perhaps "vanilla" React Native with some firebase features or Microsoft app center?
Hope this answer your question(s).

APK of react-native app shows blank screen

I have built a react-native app which works perfectly fine in development, but when I generate the APK with expo build:android, it doesn't work. If I load the app on my android device, the splash screen is displayed for a few moments and then it just shows a blank screen. I am unsure how to check what the error is when using the apk. How do I do so?
The issue could be with the SDK version. Check your device API level and the SDK version your building with.
You could set up a ADB (Android Debug Bridge) and install the apk onto a device/emulator. There you have a number of options for debugging.
Edit:
If there isn't any android specific code that uses the API then you can ignore what I said before.
Uninstall the app on your device. Settings > Apps > [Your App] > Uninstall
In your development run 'expo start'
If dev is working, then run 'expo start --no-dev --minify'
If that works then you can build 'expo build:android'
Install apk on your device || with ADB preferably
Information need for further troubleshooting:-
Device Version [Found on device Settings>System>About]
Expo SDK [Found in app.json]
ADB logs

Switching between Expo Apps Running on Android Emulator

I am sorry for the trivial question!
While testing an Expo (react-native) app on Android Emulator, I need to switch to other apps, e.g. to the Contacts Manager to add a contact. Then, I need to go back to the Expo app to test something. How can I do that?
I tried the following.
Start the Expo app and play with it
Press the Home button
Start Contacts Manager
I could NOT find a way to start the Expo app again. I found an Expo icon in the list of apps. When I clicked on it, a screen with everything disabled, except "Open from Clipboard" appeared. The "Open from Clipboard" option seems to be for switching between different Expo apps. Anyway, when I clicked on it, I got the following error message.
Something went wrong. Could not load exp://switching/%20between%20Expo%20apps%20running%20on%20Android%20Emulator.
Environment:
Expo: 32.0.0
Android Emulator: API: 25 - Android 7.1.1 x86 - Nexus S
Thank you for your effort and time to help...
Are you using a connection localhost? if yes, on the terminal, try to press 'a'.

How can I install a React Native app without releasing it to any store?

I wanna be able to use my app on my iPhone or my Android phone without the need of releasing it to App Store or Google Play Store.
or just use EXPO tools if you are open to using expo development environment for react native
If your project is based on React-Native-CLI and your development environment is all set-up then just run command 'react-native run-android' in the terminal. It will generate a debug apk file which you can be found in the directory:
android > app > build > outputs > apk > debug > app-debug.apk
You can directly install this debug apk in your android phone by connecting the device in the debugging mode and run the above command!
In Xcode, add your Apple ID to Accounts preferences, described in
Adding Your Apple ID Account in Xcode.
In the project navigator, select the project and your target to
display the project editor.
Click General and choose your name from the Team pop-up menu.
Connect the device to your Mac and choose your device from the Scheme
toolbar menu.
Below the Team pop-up menu, click Fix Issue.
Xcode creates a free provisioning profile for you and the warning text
under the Team pop-up menu disappears.
Click the Run button.
Xcode installs the app on the device before launching the app.
Test iOS app on device without apple developer program or jailbreak
For IOS you must have a developer account firstly. And then, you can send your app to itunesconnect and get the app from testflight. Or You can run your ios app on device by using cable. But you dont run your app in developer mode.
For android you just need get the apk from android studio. But some steps there are. Follow this steps for get the apk.
How can I generate an apk that can run without server with react-native?
You can Side load your react native app in iPhone or iPad using Xcode
Open your_projectname.xcworkspace from ios folder in Xcode
XCode - Choose your destination device simulator or device from
Product -> Destination -> Select the device
Create a Temporary provision profile From project Target -> Signing
& Capabilities (Required only for physical device, for simulator don't
require this)
Build and Run your project
React Native's official site has a guide on how to install your app without releasing it.
The tl;dr is as follows:
For ios:
cd AwesomeProject
react-native run-ios
For android:
cd AwesomeProject
react-native run-android