ionic app error while building Android APK - ionic-framework

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

Related

how to do prod build in ionic capacitor

In ionic 4, how to do a release aka prod build?
The angular part can be build in prod mode by ionic build --prod
Now how to copy this build to android? If I do ionic capacitor run android it will do normal build first and then copy assets to android. But I want to build in prod mode and take assets to android.
(I know how to generate apk in Android studio)
After doing
ionic build --prod
Assuming you have already installed Capacitor, otherwise you can follow this and thereafter,
You can do the following
npx cap copy android
Which copies the built code to android folder.
Then you can do
npx cap open android
Which opens android studio if you havent opened it already, then you should go to Build -> Generate Signed Bundle / APK option and the rest is quite straightforward.
More info can be found here
You can use the simple way.
ionic capacitor build android --prod
after the command, the android studio will open automatic
Development:
android stdio: Build-> Build Bundle(s)/APK(s)->Build APk(s)
Production: android stdio: Build-> Generate Signed Bundle(s)/APK(s)-> Android App Bundle or APk-> release

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!

ionic cordova build android difference between

Please Explain me difference between:
ionic cordova build android -> .apk Slowin loading
ionic cordova build android --prod -> .apk Fast in loading
ionic cordova build android --prod --release -> .apk Slow in loading
Thanks
Without flags it generates the apk debug version. And with release it generates the apk ready for the store but unsigned when you sign it you can upload it.
The --prod flag:
This will minify your app’s code as Ionic’s source and also remove any debugging capabilities from the APK.

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

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.

ionic build --release --prod ios fails

ionic build --release --prod ios has begun failing intermitently and gives the following error:
Error: Error code 65 for command: xcodebuild with args: -xcconfig
Any ideas?
Ionic 2.2.1
Xcode 8
The following procedure worked for me:
deleted the node_module folder
NPM Install
ionic Serve
Stop server
ionic platform add ios
ionic build --release --prod ios