My ionic app was running fine in the desktop browser and on ios, but not showing up at all on android. It wasn't explicitly failing, but it just resulted in a blank, white screen with no sign of life.
The same result happened both in android emulation and on an actual android device. The app would load, with its icon and everything, but its view was completely blank and empty.
SO has lots of questions about explicit ionic android build errors and platform-irrelevant errors, but nothing that quite matched what I was seeing.
I set up my android device to debug through Chrome Canary on my Mac, and was able to see the javascript console while it ran... looked like it was having trouble loading key data from an external url!
A little research showed me that this is a feature of Android Cordova, not a bug... and that the solution is to add the Whitelist Cordova plugin to ionic, whitelist the domains in question in config.xml, and rerun... that solved the problem!
The bigger mistake was that I was using resolve sections in my ui-router states, but had never thought about what to do if the promises in question never resolve!
this is a feature of Android Cordova, not a bug... and the solution is to add the Whitelist Cordova plugin to ionic, whitelist the domains in question in config.xml, and rerun.
Related
I'm currently building an app using Cordova & Crosswalk, and building it using Phonegap Build.
When creating a debug app with no key and manually installing the apk, the app installs correctly and works as expected.
However, as soon as I sign the app for production, whenever I try to install the app I get the message:
App not installed.
This app isn't compatible with your phone.
I've looked into sdk versions, features, architectures etc and as far as I can see the phone I'm using is fully compatible. I don't understand what could be changing between the unsigned and signed apps to trigger this error.
What could be changing when I sign the app which suddenly makes the app incompatible, and causes the install to fail?
While I don't understand the specifics about the signed/unsigned issue, the root cause of this was a change made in Cordova Android 6.4.0 which broke compatibility with Crosswalk:
Google also has changed the Gradle DSL used and currently support for the Crosswalk WebView is broken in this version of Cordova as a result. Unfortunately, since Crosswalk is no longer supported by the Crosswalk Project, we do not know whether this issue will be fixed.
If you require support for Crosswalk, we recommend that you continue using cordova-android 6.3.0 at this time and avoid using or upgrading your project with Android Studio.
As mentioned in the article, forcing the build process to use 6.3.0 fixed the issue for me.
I was facing the same issue today. After tons of research, found a solution. Add the following line to your config.xml:
<preference name="xwalkMultipleApk" value="false"/>
I have created an Angular 2 application and I'm looking for creating an Android application with Apache Cordova. When I load the application in a Marshmallow emulator, the application does not load any of the declared resources. If I use the browser plugin it works as expected. Using Chrome to inspect the device's console reveals the following output.
Chrome console output:
If I run the Cordova initial sample it works in the same Android emulator so it has to be a problem with the sources. The code can be checked in the Github repository. The application is in the www directory, for testing it is necessary to add the android platform.
$ cordova platform add android
$ cordova run android
I can not found an answer for this problem:
The resources looks fine - discard file path issues.
The browser plugin works (Chrome) - discard application errors and security policies.
The cordova sample works as expected for Android - discard environment errors.
Please, does anyone knows what is the problem with this setup?
I have found the root cause. The problem is that by using the angular-cli tool, the tag <base href="/"> is being added automatically. According to the tag documentation, it serves a base to resolve all the document's relative URLs.
For this use case, removing the base tag or configuring it to a valid value like <base href="/android_asset/www/"> fixes the problems. As I do not use routing features (yet) I feel more confortable removing it or setting a value like <base href="."/> that it's suitable for more platforms builds.
Have you tried modifying Content-Security-Policy?
Or how about modifying 'allow-intent' in config.xml?
When I was having resources issue, these were helping.
I have an android app built via Ionic Framework. The issue is it is working fine in the browser but not working as expected in the android app, which I installed on my phone. The issue is that I am not able to navigate the app on my phone.After connecting to chrome dev tools, seeing the link in the dev tools I found out that there is a difference. The link in dev tools is
file:///android_asset/www/index.html#/sideMenu/dashboard/dashboard/month
and link in my browser is
http://localhost:8100/#/sideMenu/dashboard/dashboard/month
could this be the reason? Most of you would be doing the same thing. So how do you guys resolve it?
EDIT
Screen shot of chrome inspect
There were errors in my app generating from the fact that It was not able to access the internet. Download the Cordova's whitelisting plugin. It should do the trick and it's a known issue that if you have even a single error in your app. It could possibly break the flow.
My issue is similar to this question.
I have an HTML5-based Android app. It is wrapped in Cordova, and built using the Ionic Framework. When launched, the app loads an index.html file, which is located locally on the device and makes a cross-origin resource request. It therefore does not load for Android API 18 and higher.
The workaround to this restriction is to enable the setAllowUniversalAccessFromFileURLs setting. Given that my project is built using the Ionic Framework, what would be the correct way to enable this flag? Would I necessarily need to go into the Android project to enable the flag, or is there a cleaner way to do it via a settings file?
I have inherited this project and have very little experience with Ionic, Cordova, and HTML5, therefore any detail would be greatly appreciated. In the question above, the solution was to update to Cordova 2.8.1. I am running Cordova 5.1.1. and still experience the problem.
Can be a origin problem try to whitelist your remote domain.
Read this http://docs.phonegap.com/en/4.0.0/guide_appdev_whitelist_index.md.html
My objective is to have an IDE with JS syntax error reporting and a PhoneGap plugin.
My goal is to make an android application using PhoneGap.
I understand that Eclipse has a well supported PhoneGap plugin.
The issue is that I have spent hours trying to get Eclipse JS syntax error reporting to work with no luck.
Netbeans is extremely easy to install and has working JS syntax error reporting with no extra steps needed. For example, with NetBeans, I just install and everything (including JS syntax error reporting) works. With Eclipse, I must install, then install several addons related to JS. In the end, I could not get the JS syntax error reporting of Eclipse to work, despite hours of research. I am new to Eclipse.
Is developing an android/phonegap app with Netbeans IDE a good method?
I found this plugin, but don't know exactly how it works with PhoneGap or if it's any good: http://www.nbandroid.org/
The Phonegap plugin described here on the PhoneGap wiki includes the default Eclipse JSDT syntax checking. It also includes an option to turn on customizable JSLint checking - see Section 7 here. This all comes with a single plug-in to add the Android ADT.
If something's not working for you, it would be great if you raised the specific problem on StackOverflow, on the mailing list, or create an issue.
From 7.4 version Netbeans has Phonegap support without external modules.
Obviously you need also phonegap and android sdk :)
see http://wiki.netbeans.org/MobileBrowsers#PhoneGap_2