Gradle wrapper problem with ionic 4 when running on android - ionic-framework

java.lang.NullPointerException when building android
Already try removing and adding android again
Exception in thread "main" java.lang.NullPointerException
at org.gradle.wrapper.BootstrapMainStarter.findLauncherJar(BootstrapMainStarter.java:38)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:26)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:108)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:62)
cmd: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.NullPointerException
at org.gradle.wrapper.BootstrapMainStarter.findLauncherJar(BootstrapMainStarter.java:38)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:26)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:108)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:62)
Picked up _JAVA_OPTIONS: -Xmx512M
[ERROR] An error occurred while running subprocess cordova.
cordova run android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
Here is ionic info
Ionic:
ionic (Ionic CLI) : 4.12.0 (I:\ionic\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.5
#ionic/app-scripts : 3.2.2
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib#8.1.1)
Cordova Platforms : android 6.4.0, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 4 other plugins)

Related

Error with gradle doing build Ionic with proxy

I'm trying to build with Ionic 6 behind a proxy. So far I haven't had any connectivity issues, but...
I get the following error:
Exception in thread "main" java.io.IOException: Downloading from https://services.gradle.org/distributions/gradle-7.1.1-all.zip failed: timeout
I will appreciate if you can help me, I am stranded with this, thank you very much
gradle 7.1.1
Ionic:
Ionic CLI: 6.19.0 (C:\Users\Guille\AppData\Roaming\npm\node_modules\#ionic\cli)
Ionic Framework : #ionic/angular 6.0.12
#angular-devkit/build-angular : 13.2.6
#angular-devkit/schematics : 13.2.6
#angular/cli : 13.2.6
#ionic/angular-toolkit : 6.1.0
Cordova:
Cordova CLI: 11.0.0
Cordova Platforms: android 10.1.1
Cordova Plugins: cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 3 other plugins)
System:
NodeJS: v16.14.1 (C:\Program Files\nodejs\node.exe)
npm: 8.5.0
OS: Windows 10

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

Ionic App not running on ios/Android but working on browser

I developed an app that was working perfectly on Ionic DevApp on my iPhone. Suddenly it stopped working. I even tested a new blank app and it does not work. I tested on many wifi and 3G signals and also on an Android phone but it does not work!
On my iPhone I’m getting the following error:
Unable to load page. The request timed out.
On the Android phone I got this error:
error err_connection_timed_out.
I tried running the following, but none worked:
ionic serve
ionic serve -c
ionic serve -c --no-proxy
Running ionic info gives me:
Ionic:
ionic (Ionic CLI) : 4.5.0 (C:\Users\rodri\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
#ionic/app-scripts : 3.2.0
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib#8.1.1)
Cordova Platforms : android 7.1.2, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.3, (and 5 other plugins)
System:
NodeJS : v10.13.0 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10
EDIT:
I tried running ionic repair which gives me this error:
shell.js: internal error
Error: ETIMEDOUT: connection timed out, read
[ERROR] An error occurred while running subprocess cordova.
cordova prepare exited with exit code 1.
It was just a Firewall coming from McAfee Firewall blocking the port I needed. Just had to open the port on the McAfee app.

Ionic framework (events.js:183 ) Unhandled 'error' event

When i used ionic serve it throws some error even though I tried many solutions like (solution 1,solution 2,solution 3) but nothing was worked and i mentioned my error below
events.js:183
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:362:16)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
I listed below my System and Ionic Information
PS G:\Ionic\FabAppLatest> ionic info
√ Gathering environment info - done!
Ionic:
ionic (Ionic CLI) : 4.2.1 (C:\Users\Align Associate\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
#ionic/app-scripts : 3.2.0
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib#8.1.1)
Cordova Platforms : android broken
Cordova Plugins : cordova-plugin-ionic-keyboard 2.0.5, cordova-plugin-ionic-webview 1.1.1, (and 28 other plugins)
System:
NodeJS : v8.12.0 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10

ionic cordova run android --prod hangs

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.