How to fix app crashing on IOS devices react-native - javascript

I am building for first time an React - Native Application . Until now we have tested the application on the several Android devices and no problem has been detected . But when the application is runned on Ios devices it crashesh almost instantly . So my question is am i doing something wrong ? I followed up the documentetion from the react-native web page and i have done the right installs , but still the problem occurs . Also when i try to build up an Android or IOS simultaor with the command :
react-native run-android
react-native run-ios
It throws me an error :
Android project not found. Maybe run react-native android first?
Or for Ios :
iOS project folder not found. Are you sure this is a React Native project?
Error: iOS project folder not found. Are you sure this is a React Native project?
My folder looks like this :
Am i missing something that should be installed ? Can you givev me some hints ? Thank you !

PandaMastr, the example image indicates that this an expo react native application, to run it you will need to go the root folder and run npm start which will launch the application. In order to use the react-native run commands you would need to eject the application ( always make a backup so you can revert if need be ); which would then create the android and iOS folder and install the react-native run aspects you are attempting to use.

Related

React Native - React app using incorrect path for index.js source

I am learning react native by working on a simple project for Android (on Windows 10).
Things were working fine and results showing correctly on Android simulator.
But now when ever I run my code on the simulator it shows this error:
I am not sure why it says "The resource D:\index.js was not found". My index.js file is not in that directory. It is in D:\folder1\folder2\index.js.
Does anyone know why it is referring to an incorrect path ?
I am of course running react-native run-android from the project folder (ie D:\folder1\folder2).
Thanks,

Cordova app installation crashes on android

Today I am trying to make a cordova app out of my existing website.
This seems to be pretty easy but there are some errors for me.
After installing everything and creating a new cordova project I only added this line in the index.js:
window.location = "http://myHomePage.net";
This should be enough for using your hosted website in a cordova android app.
And it really seems to work on my emulator but when I build the release for the app with:
cordova build --release android
and try to install the output apk my phone says:
app was not installed
How is this possible and does somebody know this issue?
The answer is don't use cordova build --release android!
cordova build android works.

React Native Expo Building Javascript Bundle stuck at 99

I'm running my react-native app using expo on my mobile.
However, when I start the packager and connect to expo app on my mobile, it's stuck at 99% for building javascript bundle process.
There has been no code change to cause this.
I have tried re-installing my node modules and restarting my packager after cleaning cache.
What is causing this issue?
Would you mind sharing a screenshot? Did you try pressing i to start the iOS simulator (if you're using iOS) Personally, I use the Expo XDE to start my expo projects. As a last resort, you can always clone your project and start from there
I had a similar problem. Turned out that i had to press enter in my console screen so it continued exporting to the expo app
It works for me.
adb kill-server
adb start-server

Adding Cordova Platforms

Hey, Guys! I recently started to work with Cordova and when I run the Cordova platform add android i get the following error. I have successfully placed the environment variables for Java and for the Android SDK as well. But the npm modules does not exist in C:/Windows/System32/npm as shown in the error, It is in the Users/My username/AppData/Roaming/npm folder. Some guidance would be appreciated.
I followed the following scripts which are shown in the official Cordova documentation to create a new project.
Cordova create hello com.example.hello HelloWorld
cd hello
Cordova platform add android -> where I'm stuck at
Kindly Check the Android Version Provided by Cordova and verify with your current Android version installed on your system , if there a mismatch :
1) Update Android Version From Android Studio SDK Manager
2) Update Cordova Platform - Refer: Cordova Documentation
External Source
cordova - Error: Failed to fetch platform android
I figured out halfway what the the problem was. There was a file named 'npm' in my C:/Windows/System32 directory wich was of 0kb size, and once i deleted it, the error vanished. But not all the way though. I was able to install the browser platform but not the android platform via cordova platform add android or even specifying what the matching cordova-andriod pluggin to be with cordova platform add andriod#version.
Only through the cordova platform add https://github.com/apache/cordova-android.git script I could install the andriod platform and once it was done other steps worked fine, and the project ran through the Android AVD. Any idea why the normal command to add the android platform didnt work, Just want to know but if it happens again i think Im gonna have to run the get from git command again. Thanks

Ionic 2 : Run a background task

I try to create a background task for my Ionic 2 app. I found this :
https://ionicframework.com/docs/v2/native/background-mode/
But my IDE doesn't found "backgroundMode" in this line :
cordova.plugins.backgroundMode.enable();
I have install the plugin.
Q : What I have to do to create a function who run when my user doesn't use the app.
And why I have this error ?
Thanks for your help.
Cordova plugins only work in devices. You can not use them on browser during development.
If you want to test that plugin, you should run your app with ionic run android (or ios) with a device plugged to PC or use an emulator. You can also run ionic build and install the debug package on a device.
In development, you can declare cordova variable with declare var cordova:any; at begining of script to avoid IDE errors of cordova being an undefined variable.

Categories

Resources