ionic cordova run android --prod hangs - ionic-framework

My ionic 3 project run OK with ionic cordova run android; however, if I added the --prod flag, i.e. ionic cordova run android --prod The process hangs without any errors. The following is where it stopped:
$ ionic cordova run android --prod
Running app-scripts build: --prod --platform android --target cordova
[23:16:47] build prod started ...
[23:16:47] clean started ...
[23:16:47] clean finished in 8 ms
[23:16:47] copy started ...
[23:16:47] deeplinks started ...
[23:16:47] deeplinks finished in 528 ms
[23:16:47] ngc started ...
[23:17:01] ngc finished in 13.21 s
[23:17:01] preprocess started ...
[23:17:01] preprocess finished in 1 ms
[23:17:01] webpack started ...
[23:17:01] copy finished in 14.49 s
IT STOPPED HERE FOREVER...
I'd retried with many times with same result. The following is my ionic info:
$ ionic info
cli packages: (C:\Users\user\AppData\Roaming\npm\node_modules)
#ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
#ionic/app-scripts : 3.1.8
Cordova Platforms : android 7.1.0
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 25.2.5
Node : v8.11.2
npm : 5.6.0
OS : Windows 10
Environment Variables:
ANDROID_HOME : C:\Android\android-sdk
Misc:
backend : pro
Please help! Thanks...

Try command
ionic cordova build android --prod --release

Any one still having this issue, a big cause of this problem is PLUGINS
run ionic cordova plugin
And have a look at your list of plugins, and uninstall All the dodgy ones, and those you arent SURE are working by running ionic cordova plugin rm your-plugin-name
This is the problem 98% of the time.

Related

Unable to build android in IONIC 6

When I run ionic cordova build android –prod i get the error:
Downloading https://services.gradle.org/distributions/gradle-7.1.1-all.zip
Exception in thread "main" java.io.IOException: Downloading from https://services.gradle.org/distributions/gradle-7.1.1-all.zip failed: timeout
I'm behind a proxy, so I set
ionic config set -g proxy http://proxy-..***:9999
I have executed ionic start myApp tabs --cordova --type=angular
I have executed ionic serve
but i can't do the build
I will be very grateful if you can help me please.
Ionic:
Ionic CLI: 6.20.3
Ionic Framework: #ionic/angular 6.3.2
Cordova:
Cordova CLI: 11.0.0
Cordova Platforms: android 10.1.2
Utility:
cordova-res: not installed globally
native-run: not installed globally
System:
NodeJS: v16.17.0 (C:\Program Files\nodejs\node.exe)
npm: 8.15.0
OS: Windows 10
Make sure you already added android in your ionic app then proceed on these steps.
Download the gradle: https://services.gradle.org/distributions/gradle-7.1.1-all.zip
Place the zip file inside: {YourAppName}/platforms/android/gradle
Set an environment variable in your OS: CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL="../gradle-7.1.1-all.zip"
Run ionic cordova build android --prod

Changes are not getting reflected in Ionic 3 app even after successful build

I met a problem for 3 days with my application ionic 3.
In fact, after builder in prod and release mode, it is always the old version that is always taken into account. the changes do not reflect.
So when mode debug, the changes are well taken.
I tried several solutions may nothing.
Ionic v3
Also i have tried many solutions but no changes
ionic cordova platforms rm android
ionic cordova platforms add android
ionic cordova build android --prod --release --aot
------------no change-------------
I have downgrade the app-scripts version always same
i have delete the www folder and run ionic serve --lab after i run build commande still no change
I need help.
Thanks you in advance
Ionic:
Ionic CLI : 5.2.3
Ionic Framework : ionic-angular 3.9.2
#ionic/app-scripts : 3.1.8
Cordova:
Cordova CLI : 8.1.2 (cordova-lib#8.1.1)
Cordova Platforms : android 7.1.4, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic 3.1.2, cordova-plugin-ionic-webview 1.2.1, (and 18 other plugins)
Utility:
cordova-res : 0.6.0
native-run : 0.2.8
System:
Android SDK Tools : 26.1.1 (C:\Sdk)
NodeJS : v10.15.1 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10
Build pass successfully
remove android platform using
ionic cordova platform rm android remove manually node-modules and
package-lock.json (imp*)
Unistall old Application
npm cache clean --force
finally run npm install
ionic cordova platform add android
ionic cordova build android
As #MD Khali said to remove the platform and add platform again, but if it happens after that you just need to click save 3-4 time. Because I have the same problem in my ionic 3 projects.
Finally I found the solution.
The problem was related to the ionic plugin (appflow).
I had two choices
1. Generate the apk from the appflow platform with the configured branch.
Remove the ionic plugin applflow
I took the choice 1.
Documentation of appflow https://ionicframework.com/appflow

I need to compile an old project (IONIC 2)

I have a project on ionic 2, which I have not touched for 3 years, but the client is asking me to change a simple link. And I can not build the application. What should I take into account to recover this project?
I do not want to migrate to ionic 3 or ionic 4, I just want to change the webservices link and that the application continues in ionic 2.
cli packages: (/usr/local/lib/node_modules)
#ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : not installed
local packages:
#ionic/app-scripts : 1.1.4
Cordova Platforms : none
Ionic Framework : ionic-angular 2.2.0
System:
Android SDK Tools : 26.1.1
ios-deploy : 1.9.2
Node : v8.9.3
npm : 5.5.1
OS : macOS
Xcode : Xcode 10.1 Build version 10B61
Is it possible to build this old project on ionic 2 on my computer?
EDIT:
when sudo ionic cordova platform add android i get:
`(node:41668) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: Failed to fetch platform cordova-android#7.0.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm WARN #ionic/app-scripts#1.1.4 requires a peer of #angular/tsc-wrapped#* but none is installed. You must install peer dependencies yourself.
npm WARN #ionic/cli-plugin-ionic-angular#1.3.1 requires a peer of #ionic/app-scripts#^1.3.7 but none is installed. You must install peer dependencies yourself.
npm ERR! Cannot read property '0' of undefined`
u should install Cordova first, like this,use # plus version number as needed
npm install -g cordova

Problems to emulate after Xcode update

After update my Xcode from 10.1 to 10.2, I have problem to emulate the app on ios emulators.
After I run $ ionic cordova emulate ios -l, I get this:
BUILD SUCCEEDED
[cordova]
[cordova] No target specified for emulator. Deploying to undefined simulator
[cordova] Device type "com.apple.CoreSimulator.SimDeviceType.undefined" could not be found.
[ERROR] An error occurred while running subprocess cordova.
$ ionic cordova emulate ios --list
Available ios virtual devices:
So I've did
$ cd platforms/ios/cordova/ && npm i ios-sim#latest
But, I keep getting No target specified for emulator. Deploying to undefined simulator, just like before.
I also tried instal the next version of ios-sim, but I think it's compatible.
$ ionic info
Ionic:
ionic (Ionic CLI) : 4.12.0 (/Users/jeansilva/.nvm/versions/node/v8.12.0/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
#ionic/app-scripts : 3.2.3
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : ios 4.5.5
Cordova Plugins : no whitelisted plugins (13 plugins total)
System:
Android SDK Tools : 26.1.1 (/Users/jeansilva/Library/Android/sdk/)
ios-deploy : 1.9.4
ios-sim : ios-sim/9.0.0-dev.1 darwin-x64 node-v8.12.0
NodeJS : v8.12.0 (/Users/jeansilva/.nvm/versions/node/v8.12.0/bin/node)
npm : 6.4.1
OS : macOS Mojave
Xcode : Xcode 10.2 Build version 10E125
Faced similar problem, after hours of making app run on simulator following command works for me
ionic cordova emulate ios --livereload --consolelogs --target="iPhone-6,com.apple.CoreSimulator.SimRuntime.iOS-10-1"
or you can try this if above don't work
ionic cordova emulate ios --livereload --consolelogs --target="iPhone-6,com.apple.CoreSimulator.SimRuntime.iOS-10-1" --buildFlag="-UseModernBuildSystem=0"
Let me know if it doesn't solve your issue.

Ionic 3 :If this is a project you'd like to integrate with Ionic, create an ionic.config.json file

I'm working with Ionic3: (version 4 is Beta yet)
Ionic:
ionic (Ionic CLI) : 4.5.0
System:
NodeJS : v8.13.0
npm : 6.4.1
OS : Linux 4.13
And I try to run a confirmed project from github (320 stars), so the npm i goes OK, but When I try to run the App I've got a strange Error:
ionic cordova run android
[ERROR] Sorry! ionic cordova run can only be run in an Ionic project directory.
If this is a project you'd like to integrate with Ionic, create an
ionic.config.json file.
So What Should I do ? if I have to create a file as recommended what I will put into it ?