ionic 2 - Application error DEVICE_READY_TIMEOUT - javascript

My Ionic 2 running on Opensuse Linux. The app runs and builds fine, However I am not able to change DEVICE_READY_TIMEOUT as it is set to 2000ms
I tried changing the value of DEVICE_READY_TIMEOUT in main.js, but that file is regenerated every time I run ionic build or run. Could anyone help ?
At the moment it throws an Application Error, on debugging in browser it says
main.js:25553 Native: device ready did not fire within 2000ms. This
can happen when plugins are in an inconsistent state. Try removing
plugins from plugins/ and reinstalling them. (anonymous) #
main.js:25553 main.js:25548 DEVICE READY FIRED AFTER 19860 ms
I have tried reinstalling a number of times, its the same. I am able to work with the app through chrome debugging. But on the android phone it shows an Application Error Dialog box.
The issue surfaced only after adding the angularfire2 library for firebase database.
System Info
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 0.0.48
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.1
Node Version: v6.9.0
Xcode version: Not installed

OK Finally found out, the issue started when I was forced to remove the plugins and reinstall them due to the bugs in the current ionic 2 Rc3 framework. I ended up not reinstalling the device plugin as it wasn't saved in the package.json file nor in the config.xml.
so the solution was to simply add the device plugin
ionic add cordova-device-plugin --save
Don't forget to add the --save option, as this adds it to your config file, and is useful should you need to reinstall the platform & plugins over again.
The other part of the problem - TIMEOUT_ERRORS can be solved by adding a line to the config.xml , if your device is taking longer to load up during the startup.
<preference name="loadUrlTimeoutValue" value="400000"/>
The timeout value is in milliseconds. as my app was taking around 30 seconds to load, I have set the timeout value to 40 secs.
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-device/

Related

Ionic 4: No emulator images (avds) found

I'm trying to emulate my ionic 4 app into Android Emulator
so I run the command:
sudo ionic cordova emulate android --prod
I get this error:
BUILD SUCCESSFUL in 1s
42 actionable tasks: 42 up-to-date
Built the following apk(s):
/Users/esham/Desktop/magazine-app/platforms/android/app/build/outputs/apk/debug/app-debug.apk
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=/Users/esham/Library/Android/sdk (DEPRECATED)
No emulator images (avds) found.
1. Download desired System Image by running: /Users/esham/Library/Android/sdk/tools/android sdk
2. Create an AVD by running: /Users/esham/Library/Android/sdk/tools/android avd
HINT: For a faster emulator, use an Intel System Image and install the HAXM device driver
[ERROR] An error occurred while running subprocess cordova.
cordova emulate android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
But I have 3 ADV on ADV Manager!!
And I could run any one of them by terminal for examble emulator #Pixel_2_API_26
These the list of ADV I have: emulator -list-avds
Pixel_2_API_26
Pixel_2_API_28
Pixel_3_API_28
When I'm running command android list avd getting:
The following Android Virtual Devices could not be loaded:
Name: Pixel_3_API_28
Path: /Users/esham/.android/avd/Pixel_3_API_28.avd
Error: Google pixel_3 no longer exists as a device
---------
Name: Pixel_2_API_26
Path: /Users/esham/.android/avd/Pixel_2_API_26.avd
Error: Google pixel_2 no longer exists as a device
---------
Name: Pixel_2_API_28
Path: /Users/esham/.android/avd/Pixel_2_API_28_1.avd
Error: Google pixel_2 no longer exists as a device
So it doesn't make any sense! I have 3 ADV with all supported levels by cordova and keep saying No emulator images (avds) found.
These my environment setup on macOS:
export ANDROID_SDK=$HOME/Library/Android/sdk
export PATH=$ANDROID_SDK/emulator:$ANDROID_SDK/tools:$PATH
export ANDROID_HOME="$HOME/Library/Android/sdk"
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH/:$ANDROID_HOME/platform-tools
I have solved the issue by adding --emulator=amulator_name
So the full command will be:
ionic cordova emulate android --prod --emulator=Pixel_3_API_28
If you run "ionic cordova run android" it's automatic run emulate by default. so try this. I hope it fixed your issue. firstly you check you Emulated Android path and it is properly downloaded or not. You run "ionic cordova resources" it checks all resources if fine or not. You need to be install anything or not. so try this.

React Native App on android build says "Unable to load script from assets'index.android.bundle' " requires a system restart

Whenever I run the application on the android phone I get this type of error shown in the image
What I have tried so far is:
regarding packager or metro bundle,I have to shut down my laptop for 10 minutes or some time then the error vanishes, why it is happening? I am using ubuntu as my operating system.
even when it's an error in code and metro bundle error shows up; still the same issue pops up.
I have tried command killing the adb server and restarting the metro too! but nothing good happens.
'yarn start/npm start' etc but it makes nothing for me except another error
on running
yarn start/npm start
i get this error
This error will be no more if I shut down the system & start after sometime & the project works fine! after it until the next error arrives.
It looks you installed some packages through super user privileges, so when you run your project, some files deny Access.
Moreover please check your react and react-native versions and update them to the latest one. To upgrade to latest version run this command
$ npm install -g react-native-git-upgrade then $ react-native-git-upgrade
Or open package.json and change versions of react to "16.6.3" and react-native to "0.57.8".

nativescript 4.2. Error while building android app with release flag

I've done some app for IOS and Android.
IOS is working fine and it's poblished on App store since 3 weeks.
So, the time has come for android. I have to do some css tweaks, beacuse android was looking different in some aspects.
After when i did it, i run tns run android, next emulator appear.
All is working well, so i've run tests on Firebase console.
It was a suprise for me, beacuse i saw this error: (Emulator installed is launching app without issues.)
Nativescript fails to load code that holds common js functions.
Here is part of my app.js
And, right now i'm able to see this error in my emulator.
Steps to reproduce:
- run tns run android (app is working well)
- do some typo in any js file (make any error): livesync will run again, and as result i will see this error.
My question is: do android have problems with requiring this file? IOS is working very well, but i'm unable to deploy android.
Thank you.

React Native Geny Motion Loading issue

I am using react native
react-native-cli: 2.0.1 react-native: 0.55.3
I was running via react-native run-android
The screen is always loading the app (Debugger Mode)
127.0.0.1:8081 responding React Native packager is running.
NOTE: It was sudden issue, it was working fine till yesterday. *PC is Restarted several time and also JS server using kill -9 PID
It may be due to you have start endabling Debug JS Remotely while running your project.
You can Stop Debug JS Remotely and reload again. It will work.
It could be related to Watchman. I had a similar problem, where "react-native run-android" would run successfully, but the app would be stuck on loading in the emulator. After trying a myriad of things, what has worked for me is to disable watchman in the project directory (or uninstall) and refresh the app manually. If the app loads, then the issue is with Watchman.

Meteor: Can’t get updates to Android Emulator (Hot Code Push)

I'm doing mobile development on an Android Emulator with Genymotion. I can't get any code changes to show up on the emulator. I always get this error, even on Startup:
Skipping downloading new version because the Cordova platform version or plugin versions have changed and are potentially incompatible
I know this a protection mechanism from bad updates, but It happens all the time. I can't even make a small CSS or JS change. They all get blocked. I tried it on Android 4.4.4, 5.0 and 6.0.
I'm using Meteor 1.4.1.2 and I simply run meteor run android-device and it pops up on the Genymotion device.
Anyone know what's causing this?

Categories