How can I install my ionic app on my android phone? - ionic-framework

I'm trying to install my ionic app on my android phone. I tried
install my ionic app on my android phone
The app ran on my phone, but when I ran the same command to run a different app, the app was replaced on my mobile. How can I keep both? I don't intend to modify any of these apps, they are ready. I tried these commands as well:
ionic cordova build android --prod --release
and
ionic cordova run android --prod --release
I got this error message:
[ERROR] An error occurred while running cordova run android --release
(exit code 1)

By default, it will overwrite the previous version. You can keep the both app using below way:
Check the config.xml file, and change the id of the app.
<widget id="new.app.id" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
Now, it will be considered as a different app and will not replace the previous one.

Related

Ionic 4: Issue building for device

Error when building for the device
I am getting an error when I try to build for the device(ionic cordova run android --device). For some reason it is not creating platforms/android/app/build/outputs/apk/debug/app-debug/apk. I have tried removing and adding android different versions. Also, I have tried ionic cordova run android --no-native-run and it loads but with a blank screen.
I found 2 solutions, so if you have a problem with running the device feature:
Update CLI!
Remove Android
ionic cordova platform rm android
Add android#6 and run ionic cordova run android --no-native-run
OR
3.add the latest android#latest and run ionic cordova run android.
Those two worked for me, depending on the version of your projects!

How to update my apk every time I make changes on my template or code changes?

How to update my apk every time I make changes on my template or code changes.
You can use the livereload feature of ionic cordova emulate or ionic cordova run to run the code on an emulator or device and see the changes live as as you code.
Here's how with the emulator:
ionic cordova emulate android --list to get a list of available emulator targets to copy into the next command.
ionic cordova emulate --livereload android -- --target="[TARGET]"
See the CLI docs for more info.
You can do livereload from a ionic cordova run <platform>, if it's an apk i assume that is for android so you can do this:
ionic cordova run android --livereload
For more options like specific port you can take a look on the docs

how to resolve installation problem in device ionic 4

I'm trying install .APK in my divece but I get the following error "app was not installed", I'm using ionic v 4 and my divece is android 6.0.1, any idea ?
Use this command for V4 :
ionic cordova build --release android
This will generate unsigned apk file under
platforms/android/build/outputs/apk/your-project-name.apk
And simply download apk file to your phone and install it. More details can be found here
I faced this error before and the cause was that using unsigned APK or the device contains app with same "App Id"
So to Solve it, Please Follow this instructions:
Use this Command
ionic cordova build android --prod
Then Try to remove any other apps from your phone that may have same app id (any old versions or sample apps) or change your app id from config.xml (before build of course)
<widget id="com.android.YOUR_UNIQE_APP_ID" ... >

ionic app error while building Android APK

I am getting the error while building the ionic app ,ionic-app-script is missing.How to add 'ionic-app-script' file in ionic 2 project? what is the purpose of this file?
just delete platform folder and run
ionic cordova build android --release --prod

Ionic3 splash screen and icon - No platfrom detected

Let me first say. Each time i run
ionic cordova build android --dev
It first run this command
cordova platform add android
At the start of the project I already added the android platform successfully. So I dont know why on every build it has to add android platform again. But each build works perfectly well on my phone. Then yesterday when I tried to run
ionic cordova resources
and it says
no platform detected. Please run ionic cordova platfrom add
Please help