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
Related
I'm using #ionic/react in order to build an Android app. Everything worked fine, but I do not seem to be able to build an android version of it.
The commands
$ ionic build
$ ionic serve
$ ionic integrations enable capacitor
$ ionic cap add android
$ ionic cap open android
all give me the error message:
[ERROR] Invalid project type: react (project config: .\ionic.config.json).
Project type must be one of: angular, ionic-angular, ionic1, custom
Do I interpret this correctly that #ionic/react is not yet full supported?
I am confused, thought I built an #ionic/react-app for android before.
Been following this documentation: https://ionicframework.com/docs/react/your-first-app
My ionic.config.json:
{
"name": "Prototype",
"integrations": {},
"type": "react"
}
Important dependencies from package.json:
"dependencies": {
"#ionic/react": "^4.11.0",
"#ionic/react-router": "^4.11.0",
"#react-google-maps/api": "1.7.12",
"#types/jest": "^24.0.18",
"#types/node": "^12.7.12",
"#types/react": "^16.9.5",
"#types/react-dom": "^16.9.1",
"#types/react-router": "^5.1.1",
"#types/react-router-dom": "^5.1.0",
"ionic": "4.12.0",
"ionicons": "^4.6.3",
"react": "^16.10.2",
"react-dom": "^16.10.2",
"react-router": "^5.1.0",
"react-router-dom": "^5.1.0",
"react-scripts": "3.2.0",
"typescript": "3.6.3"
},
I got the same issue, you have to update ionic to the latest version.
npm uninstall -g #ionic/cli
npm install -g #ionic/cli#latest
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?
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 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.
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.