Ionic app is not running is android studio emulator - android

I cannot run my ionic app in android studio emulator. when i am using ionic run android. It shows
`
myApp1#0.0.1 ionic:build D:\workspace\cordova\myApp1
> ionic-app-scripts build
[12:45:20] ionic-app-scripts 2.0.2
[12:45:20] build dev started ...
[12:45:20] clean started ...
[12:45:20] clean finished in 5 ms
[12:45:20] copy started ...
[12:45:20] transpile started ...
[12:45:22] transpile finished in 1.93 s
[12:45:22] preprocess started ...
[12:45:22] deeplinks started ...
[12:45:22] deeplinks finished in 11 ms
[12:45:22] preprocess finished in 12 ms
[12:45:22] webpack started ...
[12:45:22] copy finished in 2.08 s
[12:45:27] webpack finished in 5.11 s
[12:45:27] sass started ...
[12:45:27] sass finished in 691 ms
[12:45:27] postprocess started ...
[12:45:27] postprocess finished in 6 ms
[12:45:27] lint started ...
[12:45:27] build dev finished in 7.78 s
[12:45:29] lint finished in 1.73 s
D:\workspace\cordova\myApp>
`
I am using cordova 5.0.0 and ionic 2.2.3. How it possible to run on emulator. I have tried for long time. So please help me.

Related

Ionic hang when run ionic serve and error at lint finished in 5.98 s

this is when i run ionic serve, and hang at lint finished
C:\workspace\myApp (master -> origin)
λ ionic serve
Starting app-scripts server: --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser -
Ctrl+C to cancel
[17:59:25] watch started ...
[17:59:25] build dev started ...
[17:59:25] clean started ...
[17:59:25] clean finished in 16 ms
[17:59:25] copy started ...
[17:59:26] copy finished in 670 ms
[17:59:26] deeplinks started ...
[17:59:26] deeplinks finished in 28 ms
[17:59:26] transpile started ...
[17:59:37] transpile finished in 11.26 s
[17:59:37] preprocess started ...
[17:59:37] preprocess finished in 2 ms
[17:59:37] webpack started ...
[17:59:48] webpack finished in 11.52 s
[17:59:48] 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.
[17:59:51] sass finished in 2.90 s
[17:59:51] postprocess started ...
[17:59:51] postprocess finished in 33 ms
[17:59:51] lint started ...
[17:59:51] build dev finished in 26.60 s
[17:59:52] watch ready in 27.00 s
[17:59:52] dev server running: http://localhost:8100/
[OK] Development server running!
Local: http://localhost:8100
External: http://10.100.95.80:8100
DevApp: myApp#8100 on DESKTOP-9D89Q03
[17:59:57] lint finished in 5.12 s
hang after that
this is my ionic info
λ ionic info
cli packages: (C:\Users\NgimpiModol\AppData\Roaming\npm\node_modules)
#ionic/cli-utils : 1.19.1
ionic (Ionic CLI) : 3.19.1
local packages:
#ionic/app-scripts : 3.1.8
Ionic Framework : ionic-angular 3.9.2
System:
Node : v8.9.4
npm : 5.6.0
OS : Windows 10
but the project is run at browser google chrome, please help me...
Can you specify what exactly you mean with "it hangs after lint finished"? That just means that the Development Server is up and running and you should be good to go. Is livereload not working?

ionic 3 - UnhandledPromiseRejectionWarning when generating android build

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

Ionic 3.10.3 ERROR when i update

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.

Im not able to build ionic2 app

im trying to build and ionic 2 app for test im my android but i dont get anything.
My setup (ionic info):
Cordova CLI: 5.1.1
Gulp version: CLI version 3.9.1
Gulp local:
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
OS: Distributor ID: Ubuntu Description: Ubuntu 14.04.3 LTS
Node Version: v5.11.0
My dependencies:
"dependencies": {
"#angular/common": "2.0.0",
"#angular/compiler": "2.0.0",
"#angular/compiler-cli": "0.6.2",
"#angular/core": "2.0.0",
"#angular/forms": "2.0.0",
"#angular/http": "2.0.0",
"#angular/platform-browser": "2.0.0",
"#angular/platform-browser-dynamic": "2.0.0",
"#angular/platform-server": "2.0.0",
"ionic-angular": "2.0.0-rc.0",
"ionicons": "3.0.0",
"#ionic/storage": "1.0.3",
"ionic-native": "2.0.3"
},
"devDependencies": {
"#ionic/app-scripts": "0.0.36",
"typescript": "2.0.3"
}
The console messages are (ionic build android):
Running 'build:before' npm script before build
> ionic-app-base# build /home/fdom/repos/Pantrify
> ionic-app-scripts build
[15:38:53] ionic-app-scripts 0.0.36
[15:38:53] build prod started ...
[15:38:53] clean started ...
[15:38:53] clean finished in 9 ms
[15:38:53] copy started ...
[15:38:53] ngc started ...
[15:38:53] copy finished in 339 ms
[15:38:53] lint started ...
[15:38:56] lint finished in 2.52 s
[15:39:21] ngc finished in 28.49 s
[15:39:21] bundle started ...
[15:39:35] bundle finished in 13.74 s
[15:39:35] uglifyjs started ...
[15:39:35] sass started ...
[15:39:40] sass finished in 4.88 s
[15:39:40] cleancss started ...
[15:39:43] cleancss finished in 3.42 s
[15:39:52] uglifyjs finished in 16.86 s
[15:39:52] build prod finished in 59.12 s
prompt>_
But if a run a ionic serve it goes perfectly:
Running 'serve:before' npm script before serve
> ionic-app-base# watch /home/fdom/repos/Pantrify
> ionic-app-scripts watch
[15:50:20] ionic-app-scripts 0.0.36
[15:50:20] watch started ...
[15:50:20] build dev started ...
[15:50:20] clean started ...
[15:50:20] clean finished in 6 ms
[15:50:20] copy started ...
[15:50:20] transpile started ...
[15:50:21] lint started ...
[15:50:23] lint finished in 2.46 s
[15:50:25] transpile finished in 4.69 s
[15:50:25] bundle started ...
[15:50:25] copy finished in 4.76 s
[15:50:36] bundle finished in 10.69 s
[15:50:36] sass started ...
[15:50:40] sass finished in 3.84 s
[15:50:40] build dev finished in 19.24 s
[15:50:40] watch ready in 19.57 s
Running live reload server: http://localhost:35729
Watching: www/**/*, !www/lib/**/*, !www/**/*.map
√ Running dev server: http://localhost:8100
Ionic server commands, enter:
restart or r to restart the client app from the root
goto or g and a url to have the app navigate to the given url
consolelogs or c to enable/disable console log output
serverlogs or s to enable/disable server log output
quit or q to shutdown the server and exit
ionic $
I tryed a lot, removing/adding platform, uninstaslling/installing node modules, build with another node version using nvm(4.4.0, 5.11.0, 5.6.0) but nothing works. I think its the ionic cli but not sure.
Thank you so much
I think you should use some below command:
$ionic platform remove android
$ionic hooks add
$ionic platform add android

Can't seem to generate an APK from ionic project

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.

Categories

Resources