I am using ionic 3.19 and when I try to create an android build it has the following error. With ios its fine. What is this problem and how to solve this ?
I am using node v8.9.1.
(node:49779) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: spawn EACCES
Here is the execution and the problem output
$ ionic cordova build android --release
Running app-scripts build: --platform android --target cordova
[18:01:13] build dev started ...
[18:01:13] clean started ...
[18:01:13] clean finished in 6 ms
[18:01:13] copy started ...
[18:01:13] deeplinks started ...
[18:01:13] deeplinks finished in 97 ms
[18:01:13] transpile started ...
[18:01:17] transpile finished in 4.06 s
[18:01:17] preprocess started ...
[18:01:17] preprocess finished in less than 1 ms
[18:01:17] webpack started ...
[18:01:17] copy finished in 4.30 s
[18:01:25] webpack finished in 7.47 s
[18:01:25] sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[18:01:26] sass finished in 1.26 s
[18:01:26] postprocess started ...
[18:01:26] postprocess finished in 13 ms
[18:01:26] lint started ...
[18:01:26] build dev finished in 13.04 s
> cordova build android --release
ANDROID_HOME=/Users/megasap/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_71.jdk/Contents/Home
(node:49779) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: spawn EACCES
(node:49779) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[18:01:29] tslint: src/pages/attandance-detail/attandance-detail.ts, line: 175
'marker' is declared but never used.
L174: console.log(location)
L175: let marker = new google.maps.Marker({
L176: position: location,
[18:01:29] tslint: src/pages/home/home.ts, line: 260
'marker' is declared but never used.
L259: addMarker(location, map) {
L260: let marker = new google.maps.Marker({
L261: position: location,
[18:01:29] lint finished in 3.00 s
UPDATE:
This is the execution and error with node v9.4.0. This has a bit more detail than the previous running on node v8.9.1.
https://gist.github.com/axilaris/4cc7094c7dae28477eb2f348e53fad91
this did the trick!
sudo chmod 777 /Applications/Android\ Studio.app/Contents/gradle/gradle-4.1/bin/gradle
I just had this problem and after updating Android Studio and it updated gradle from 4.1 to 4.4 then I had to update my environment variable and go to the new gradle location /opt/android-studio/gradle/gradle-4.4/bin and do chmod 777 gradle
Related
i am new to ionic, trying to get an apk for debugging i used the following commands inside the project directory:
ionic cordova platform add android
i did get "platforms/android" directory
and then i used:
ionic cordova build android
this is what i get after:
ionic-app-scripts build --target cordova --platform android
[23:57:19] ionic-app-scripts 3.1.10
[23:57:19] build dev started ...
[23:57:19] clean started ...
[23:57:19] clean finished in 10 ms
[23:57:19] copy started ...
[23:57:19] deeplinks started ...
[23:57:19] deeplinks finished in 36 ms
[23:57:19] transpile started ...
[23:57:27] transpile finished in 8.13 s
[23:57:27] preprocess started ...
[23:57:27] preprocess finished in less than 1 ms
[23:57:27] webpack started ...
[23:57:28] copy finished in 8.97 s
[23:57:35] webpack finished in 7.63 s
[23:57:35] sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[23:57:40] sass finished in 4.83 s
[23:57:40] postprocess started ...
[23:57:40] postprocess finished in 28 ms
[23:57:40] lint started ...
[23:57:40] build dev finished in 20.79 s
[23:57:44] lint finished in 3.91 s
> cordova build android
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Android Studio project detected
(node:12696) UnhandledPromiseRejectionWarning: CordovaError: Failed to find 'ANDROID_HOME' environment variable. Try setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
at C:\Users\h2001\Desktop\myApp\platforms\android\cordova\lib\check_reqs.js:305:19
at _fulfilled (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:816:13)
at C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:877:14
at runSingle (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:137:13)
at flush (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
(node:12696) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:12696) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
but i didn't get the promised \build\outputs\apk, what is the problem?
UPDATE: i installed android studio and updated it, still getting
(node:12696) UnhandledPromiseRejectionWarning
UPDATE: the problem was solved, turns out i had java10 which wont work with android, simply installing java8 solved the problem
btw, i dont have android sdk installed if that makes any difference?
You have answered your own question.
To make an Android APK
You need Java SDK 1.8.
Android SDK with latest build tools and platforms
JAVA_HOME & ANDROID_HOME environmental variables set correctly.
Also You need updated X-Code on a Mac to create an IPA.
You probably doesn't have android environment variable in your PC.
if you are running MAC try running:
sudo export ANDROID_HOME=/<installation location>/android-sdk-macosx
sudo export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
If you are running Linux then:
export ANDROID_HOME=/<installation location>/android-sdk-linux
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
And if you are running Windows then open your command prompt as Administrator and run:
set ANDROID_HOME=C:\<installation location>\android-sdk-windows
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
It will add enviroment variable to your system.
I 've been working on this issue for a lot of time and I can't really fix it. When I do ionic Cordova build android it works well until it gets to Cordova build android, anyone has some idea about what happened here??
I know that if a problem with permission but I can't found what is the directory I'd change
KENRYMAC:RecipeBookApp Kenry$ ionic cordova build android
Running app-scripts build: --platform android --target cordova
[23:36:09] build dev started ...
[23:36:10] clean started ...
[23:36:10] clean finished in 5 ms
[23:36:10] copy started ...
[23:36:10] deeplinks started ...
[23:36:11] deeplinks finished in 161 ms
[23:36:11] transpile started ...
[23:36:51] transpile finished in 40.73 s
[23:36:51] preprocess started ...
[23:36:51] preprocess finished in 1 ms
[23:36:51] webpack started ...
[23:36:52] copy finished in 42.36 s
[23:37:20] webpack finished in 28.48 s
[23:37:20] sass started ...
Witout `from` option PostCSS could generate wrong source map or do not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning
[23:37:23] sass finished in 2.94 s
[23:37:23] postprocess started ...
[23:37:23] postprocess finished in 17 ms
[23:37:23] lint started ...
[23:37:23] build dev finished in 73.84 s
> cordova build android
ANDROID_HOME=/Users/Kenry/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
(node:4570) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: spawn EACCES
(node:4570) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[23:37:31] tslint: src/pages/signin/signin.ts, line: 4
'FormControl' is declared but never used.
L4: import { FormControl, NgForm } from '#angular/forms';
[23:37:31] tslint: src/pages/signup/signup.ts, line: 4
'FormControl' is declared but never used.
L4: import { FormControl, NgForm } from '#angular/forms';
[23:37:31] lint finished in 8.22 s
Please, can anyone give me some clues?? Thank you
Run the following command:
cordova build android --verbose
You can get output something like this:
Running command: /usr/libexec/java_home
Command finished with error code 0: /usr/libexec/java_home
ANDROID_HOME=/Users/mj/phonegap/adt-bundle-mac-x86_64-20140321/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
Running command: "/Applications/Android Studio.app/Contents/gradle/gradle-2.2.1/bin/gradle"
-p /Users/mj/EduceMobile/app/platforms/android wrapper -b /Users/mj/EduceMobile/app/platfo
rms/android/wrapper.gradle
Error: spawn EACCES
at exports._errnoException (util.js:1018:11)
at ChildProcess.spawn (internal/child_process.js:319:11)
at Object.exports.spawn (child_process.js:378:9)
.....
.....
Note the line:
Running command: "/Applications/Android
Studio.app/Contents/gradle/gradle-2.2.1/bin/gradle"
This shows that there is permission issue with the file /Applications/Android Studio.app/Contents/gradle/gradle-2.2.1/bin/gradle.
To fix the issue, give appropriate permission to that file so that it can be executable.
You can run the following command:
sudo chmod +x /Applications/Android Studio.app/Contents/gradle/gradle-2.2.1/bin/gradle
This should solve the issue.
If apple push services certificate not displays in key chain
Quit keychain access
Right-click the .cer file (e.g. aps_production.cer)
Select Open With > Keychain access (default)
I'm trying to build APK file with IONIC. I'm following all the tutorials and everything was OK until I tried to build APK with this command:
$ ionic cordova build --release android
and show me this error:
$ ionic cordova build --release android
Running app-scripts build: --platform android --target cordova
[22:57:28] build dev started ...
[22:57:28] clean started ...
[22:57:28] clean finished in 9 ms
[22:57:28] copy started ...
[22:57:30] deeplinks started ...
[22:57:31] deeplinks finished in 416 ms
[22:57:31] transpile started ...
[22:57:38] transpile finished in 7.50 s
[22:57:38] preprocess started ...
[22:57:38] preprocess finished in less than 1 ms
[22:57:38] webpack started ...
[22:57:40] copy finished in 11.79 s
[22:57:57] webpack finished in 18.34 s
[22:57:57] sass started ...
[22:57:59] sass finished in 2.21 s
[22:57:59] postprocess started ...
[22:57:59] postprocess finished in 17 ms
[22:57:59] lint started ...
[22:57:59] build dev finished in 30.98 s
> cordova build android --release
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Android Studio project detected
(node:7784) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'variables' of undefined
(node:7784) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[22:58:05] tslint: ...der (8)/App Source Code/App Source Code/src/providers/shared-data/shared-data.ts, line: 71
Property 'push' is declared but never used.
L70: public events: Events,
L71: private push: Push,
L72: public platform: Platform,
[22:58:05] tslint: ...der (8)/App Source Code/App Source Code/src/providers/shared-data/shared-data.ts, line: 8
'PushObject' is declared but never used.
L7: import { LoadingProvider } from '../loading/loading';
L8: import { Push, PushObject, PushOptions } from '#ionic-native/push';
L9: import { Device } from '#ionic-native/device';
[22:58:05] tslint: ...der (8)/App Source Code/App Source Code/src/providers/shared-data/shared-data.ts, line: 8
'PushOptions' is declared but never used.
L7: import { LoadingProvider } from '../loading/loading';
L8: import { Push, PushObject, PushOptions } from '#ionic-native/push';
L9: import { Device } from '#ionic-native/device';
[22:58:05] tslint: ...der (8)/App Source Code/App Source Code/src/providers/shared-data/shared-data.ts, line: 10
All imports are unused.
L9: import { Device } from '#ionic-native/device';
L10: import { Facebook } from '#ionic-native/facebook';
L11: import { FCM } from '#ionic-native/fcm';
[22:58:05] tslint: ...zm/Desktop/New folder (8)/App Source Code/App Source Code/src/pages/cart/cart.ts, line: 44
Property 'storage' is declared but never used.
L43: public toast: Toast,
L44: private storage: Storage,
L45: public events: Events,
[22:58:05] tslint: ...op/New folder (8)/App Source Code/App Source Code/src/pages/products/products.ts, line: 8
All imports are unused.
L7: import { TranslateService } from '#ngx-translate/core';
L8: import { share } from 'rxjs/operator/share';
L9: import { CartPage } from '../cart/cart';
[22:58:05] lint finished in 6.59 s
Building your Application is different than serving it. It's more restrictive cause your App needs to respect the norms of the platform you're targeting.
So you have to correct the mistakes you're seeing in the logs (like deleting some variables or imports you're not using for example:
`import { Device } from '#ionic-native/device';`
Edit:
you Have unused imports. Though it's not an Error, it's a mistake. So when building your app you shouldn't do that.
Also you have some unused private variables So delete them please.
Just read the logs you'll know the location of the mistakes & what to remove.
I update ionic 3.10.2 to 3.10.3 and i got this when i try build or something.
geen$ ionic serve
[INFO] Starting app-scripts server: --address 0.0.0.0 --port 8100
--livereload-port 35729 --dev-logger-port 53703 - Ctrl+C to cancel
[15:17:28] watch started ...
[15:17:28] build dev started ...
[15:17:28] clean started ...
[15:17:28] clean finished in 1 ms
[15:17:28] copy started ...
[15:17:28] transpile started ...
[15:17:30] transpile finished in 1.99 s
[15:17:30] preprocess started ...
[15:17:30] deeplinks started ...
[15:17:30] deeplinks finished in 22 ms
[15:17:30] preprocess finished in 22 ms
[15:17:30] webpack started ...
[15:17:30] copy finished in 2.09 s
If i type ionic serve or ionic cordova build android or ionic cordova run android -c -l to debug in my phone I get the same print.
I found the error. When you have in a component more than one class in the same .ts file ionic don't print the error but at the same time doesn't compile.
i am new to ionic, trying to get an apk for debugging i used the following commands inside the project directory:
ionic cordova platform add android
i did get "platforms/android" directory
and then i used:
ionic cordova build android
this is what i get after:
ionic-app-scripts build --target cordova --platform android
[23:57:19] ionic-app-scripts 3.1.10
[23:57:19] build dev started ...
[23:57:19] clean started ...
[23:57:19] clean finished in 10 ms
[23:57:19] copy started ...
[23:57:19] deeplinks started ...
[23:57:19] deeplinks finished in 36 ms
[23:57:19] transpile started ...
[23:57:27] transpile finished in 8.13 s
[23:57:27] preprocess started ...
[23:57:27] preprocess finished in less than 1 ms
[23:57:27] webpack started ...
[23:57:28] copy finished in 8.97 s
[23:57:35] webpack finished in 7.63 s
[23:57:35] sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[23:57:40] sass finished in 4.83 s
[23:57:40] postprocess started ...
[23:57:40] postprocess finished in 28 ms
[23:57:40] lint started ...
[23:57:40] build dev finished in 20.79 s
[23:57:44] lint finished in 3.91 s
> cordova build android
You have been opted out of telemetry. To change this, run: cordova telemetry on.
Android Studio project detected
(node:12696) UnhandledPromiseRejectionWarning: CordovaError: Failed to find 'ANDROID_HOME' environment variable. Try setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
at C:\Users\h2001\Desktop\myApp\platforms\android\cordova\lib\check_reqs.js:305:19
at _fulfilled (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:816:13)
at C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:877:14
at runSingle (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:137:13)
at flush (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
(node:12696) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:12696) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
but i didn't get the promised \build\outputs\apk, what is the problem?
UPDATE: i installed android studio and updated it, still getting
(node:12696) UnhandledPromiseRejectionWarning
UPDATE: the problem was solved, turns out i had java10 which wont work with android, simply installing java8 solved the problem
btw, i dont have android sdk installed if that makes any difference?
You have answered your own question.
To make an Android APK
You need Java SDK 1.8.
Android SDK with latest build tools and platforms
JAVA_HOME & ANDROID_HOME environmental variables set correctly.
Also You need updated X-Code on a Mac to create an IPA.
You probably doesn't have android environment variable in your PC.
if you are running MAC try running:
sudo export ANDROID_HOME=/<installation location>/android-sdk-macosx
sudo export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
If you are running Linux then:
export ANDROID_HOME=/<installation location>/android-sdk-linux
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
And if you are running Windows then open your command prompt as Administrator and run:
set ANDROID_HOME=C:\<installation location>\android-sdk-windows
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
It will add enviroment variable to your system.