I can't run Android APK of my ionic apps on my tablets (Android version 4.4), I get the connection unsuccessful error. I have no idea why, it happens even if I start a ionic project from scratch and run the apk without modifying anything in the project. Weird thing is..I can run it on my Xperia celphone and also if I emulate a Nexus 9 tablet with android studio the Apk also works. How can I fix this? maybe build the apk with older android api? is there a way of doing this, or isn't this related?
Already tried setting loadUrlTimeoutValue to a high number, makes no difference.
Aaaaaaaaaaaaaaaaaaaaaaaaah finally got it FFS, had to add cordova crosswalk plugin to make it work. Followed this > https://github.com/codyteng/ionic2-android-crosswalk
ionic plugin add cordova-plugin-crosswalk-webview
ionic platform add android
ionic run android
Related
I added Cordova to an Angular Project, where I create an Angular build and populate it into the Cordova app:
ng build --prod --base-href . --output-path ./cordova/www/
I then run that app inside Android Studio so I can emulate what it'll look like on a device.
The Cordova app runs, but if I go and make updates to the Angular app and then run the build script again, the version Android Studio sees is the old version.
The only way I've found to get around this is whenever I Invalidate Caches, but that seems cumbersome and like there must be a better option.
I verified that the files inside the Cordova app are the updated build files (I checked for the version marker). I've tried stopping and starting the emulator, telling Android Studio to rebuild the app, as well as stopping and starting the app inside Android Studio.
Can someone please tell me what I'm missing? TIA.
I just started Learnig Ionic and after a successful deploy of myapp (generate apk and install in my phone), i still get a web page error on my android device 'Could not connect to server (http://localhost:8080/)'
I believe the app should be offline because i haven't used any web service. check out the error here
The url http://localhost:8080/ would only work on the emulator but not on an actual android device.
Find the method webview.loadUrl() most likely on the MainActivity.java and change to something like webview.loadurl("file:///android_asset/www/index.html") instead of webview.loadurl("http://localhost:8080/");
Your app is offline.
A plugin that all Ionic apps have been using for ages, cordova-plugin-ionic-webview, released a new version 2.x on July 23rd 2018. This added a webserver into the Android app that is used to deliver your app files to the webview displaying your app. It runs on localhost:8080.
Unfortunately version 2 of cordova-plugin-ionic-webview does not support Android 4.x any more which you seem to be using. This is the eason why you are getting that error message.
You can probably fix your problem by downgrading to the last version of the plugin that supported Android 4.x:
ionic cordova plugin add cordova-plugin-ionic-webview#1.2.1
More elaborate information and alternative solutions:
https://ionic.zone/debug/ionic-and-android-4
Hello I'm trying to build a mobile app out of cordova but I have 0 knowledge on it so I read and tried documentation of cordova but it seems like I'm stuck on the emulation part after I input cordova build on terminal it compiles the project and notifies me that the build was a success.. But after I ran cordova emulate android it compiles for a few sec then gives an error message the error message is
anyone know whats the problem here?? Basically everything I've done was from the documentation of the cordova site. also my android emulator is running before I run the command cordova emulate android
Have you tried specifying the emulator to run the app with?
cordova run android --target=youremulatorname
or
cordova emulate android --target=youremulatorname
Also, check whether your emulator uses the API level between the indicated android:minSdkVersion and android:targetSdkVersion in the generated AndroidManifest.xml file.
The AndroidManifest.xml file can be found in
YourAppFolder/platforms/android/AndroidManifest.xml
You can check which API level your emulator uses through
SDK Manager > Tools > Manage AVDs
I'm building an app for Android with Ionic/Cordova. The app works fine in the emulator and works fine in the Ionic view app.
The app connects to an API in our internal network and everything works fine.
The problem is, when I build the cordova app to Android and install the apk, it doesn't connect to the internet. I can't seem to find what the problem is and why it is not connecting, even though it does work in the emulator and Ionic view.
Does anyone know what the problem would be and why it doesn't work?
It seems I had to install the Ionic whitelist plugin: http://docs.ionic.io/docs/cordova-whitelist
Now it is working! Thanks for your help guys
This plugin saved my time:
cordova plugin add cordova-plugin-whitelist
I am having issues getting a legacy mobile app to run in an emulator - it all seems to run in the browser without any issues but when I run the cordova emulate command the app attempts to install but I always get a white screen (nothing else) & the app isn't visible to use.
I am running Cordova CLI v5.0.0 although the app was made about a year ago so was developed in an older version of Cordova.
Can anyone suggest the best ways to debug this app to find the cause of the problem & why the problem only persists when I run the emulate command but seems fine in the browser?
-- update --
I have installed the Samsung drivers to allow me to connect my OnePlusOne device to adb, and I am know using the Android Studio program to collate errors etc..
In Android studio I can see the logs (see gist below):
https://gist.github.com/gkimpson/fbde0f5a7d1017daae17
Its quite long so added it externally - any ideas why I am having problems with my app?
-- update --
This line seems to be the problem
D/SystemWebChromeClient﹕ file:///android_asset/www/js/app/modules/stickers/stickers.js: Line 357 : Uncaught TypeError: window.requestFileSystem is not a function
The code in stickers.js is below for that section..
if (window.isDevice) {
window.requestFileSystem(window.PERSISTENT, 512, onInitFs, errorHandler);
} else {
callback(fc);
}
Ok here is what I had to do when I migrated from cordova 3.6 to cordova 5.
But first, I suggest you a little reading :
Cordova Android 4 release notes
Plugins switch to npm
The white list plugin documentation And in addition the CSP documentation
To sum-up, the security has changed in cordova, if you don't add the white list plugin your app will have no network access, and the plugins are now installed via npm instead of via git.
So what I did (a little bit hardcore maybe):
delete completly the platforms/android folder
delete the plugins folder (maybe before cordova plugins list if you don't have the list somewhere)
reinstall the plugins with the new name (most of external plugins haven't changed name, but all cordova plugins have) for example cordova-plugin-camera replaces org.apache.cordova.camera
add the white list plugin and configure it (or if you're not concerned about security, install the white list-legacy plugin which should work as previous versions)
add the android platform
and you can run cordova plugin save and cordova platform saveto have all your plugins and platforms saved in config.xml