Ionic 2 build release 404 error - build

I build an ionic 2 app. When I build an android debug version with ionic build android --prod the app works like a charm. But when I build the same unchanged app with ionic build android --prod --release and I sign the app and zip align it and open the app nothing works and all request give a 404 error. Anyone suggestions?
I installed the whitelist plugin and also set the meta security in the index and in the config.xml the <allow tags

Problem was the SSL certificate. The hoster forgot to add the Intermediate Certificate. On IOS this is no problem but on android it is.

Related

Ionic2: Package com.my.app has no certificates at entry AndroidManifest.xml

I created one application using Ionic2 and when i run the command ionic cordova run android --prod --release I am getting an error
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Package /data/app/vmdl
971492117.tmp/base.apk has no certificates at entry AndroidManifest.xml]
Do anyone know how to fix this error?
NB: I have seen similar questions all of them are for native application development.
You cannot install a package build with --release without signing it. See this question on Ionic Forum
Try ionic cordova run android --prod to install an unsigned app to your phone.
Probably you have another app installed with the same name, signed with another type of key. Ie in your device you the app singed with a release key. Other possibility is there is an app in your device with a newer version.

ionic cordova plugin add cordova-plugin-advanced-http already installed

I am new on Ionic Mobile application development, so I am trying to POST data from Ionic app. Whenever I have run the app in browser using
ionic cordova run browser
It display below issue in console,
Native: tried calling HTTP.post, but the HTTP plugin is not installed.
Install the HTTP plugin: 'ionic cordova plugin add cordova-plugin-advanced-http'.
I have installed same plugin using terminal but terminal give warnings as its already installed.
Please Suggest.
Based on this https://ionicframework.com/docs/native/http/ you also need to run
npm install --save #ionic-native/http
and referencing it correctly in your app, please take a look at above link
Also for running app in browser try below command
Ionic serve
See https://github.com/ionic-team/ionic-native/issues/1975
The issue appears to have been fixed but there might be a lag in updating npm
I hade the same problem and I solve it with uninstall and reinstall the plugin
Uninstall plugin completely
ionic cordova plugin remove cordova-plugin-advanced-http
npm uninstall #ionic-native/http
and reinstall it
ionic cordova plugin add cordova-plugin-advanced-http
npm install #ionic-native/http
The Native Http plugin is the only way to handle the CORS from the client-side.
The way I see your problem, there might two possible fixes
Check whether the plugin is called after the platform.ready().
Even after it, if doesn't work or show the same error then follow this method.
// Declare cordova as a global constant
declare const cordova;
// directly call the cordova pulgin using "cordova.pulgin.http"
cordova.plugin.http.post(apiUrl, {}, {},
response => {},
response => {})

ionic serve not compiling typescript

I started working on this project on my home PC on Windows 10 using the latest version of Ionic CLI and Typescript and ionic serve works perfectly there.
However after cloning the exact same project to my work PC with Ubuntu which is also running the latest version of Ionic, I get this error when I try to use ionic serve:
"www" directory cannot be found. Please make sure the working directory is an Ionic project.
So obviously now on this PC it's not compiling the Typescript before running it. Somehow on my work PC it thinks this is a plain JS project?

ionic 2 for browser platform is not working

I want to create an app which is able to run in mobile phone and also in browser (of course no device dependency functions). Here are the steps:
ionic start --v2 demo blank
cd demo
ionic platform add browser
ionic build browser
cd platforms/browser
php -S localhost:8000
Then open localhost:8000 in browser.
I looked through the ionicframework document. There is nothing about platform browser. Can anybody advise how I can run my app in browser? Thanks.
You don't need to add the browser platform, just run ionic serve:
ionic start --v2 demo blank
cd demo
ionic serve
Further information can be found here.
From the official documentation ionic2, its clear that the platform can either be ios or android as shown below screenshot.
So, when you want to render it in a browser, you can simply use
ionic serve
If you want to run browser platform, then cd platforms/browser/www instead of cd platforms/browser, and run local server from there.
Perform the following code at the root of the project and then the web-browser based version will be generated at /www/ folder including the sub-directories such as assets, build & index.html which is the main point of entry for the web app.
If you wanna have the app packaged as a staging or production bundle, the following command can be used, which will again generate the prod build at the same /www/location.
npm run ionic:build --prod

Ionic 1 and Ionic 2 side by side?

I have a project built on Ionic 1 that I need to continue to develop and support. I'd also like to install Ionic RC2 and begin a new project with that. Can I run both versions of Ionic on the same development machine?
Yes you can.
If you run 'ionic-serve' in your first project folder, the default port to access it should be 8100. If you run another 'ionic-serve' in your ionic2 project folder, the default port to access should be 8101.
This way you can have your ionic1 project : localhost:8100, and your ionic2 project on localhost:8101.
The same CLI is used in both cases ;-)