Friends,
I tried to buid apk on command
ionic cordova build android
it shows following message as below
but could not see any apk on path.
Please advise
Thanks
Anes
Friends,
I tried to buid apk on command
ionic cordova build android
it shows following message as below
but could not see any apk on path.
Please advise
Thanks
Anes
have you checked this?
platforms\android\build\outputs\apk
You will not see your APK File unless you build it with Cordova Android not with Ionic Serve.
If you didnt add your Android Platform please do:
ionic cordova platform add android
after that you have to do this for a debug release:
ionic cordova build android
or this for a production release:
ionic cordova build android --prod --release
After that you will find your APK file in this path:
platforms\android\build\outputs\apk
Please Note that it will take time depend on your envrioment.
So wait until it says it is finished.
It will also tell you the location of your APK file at the end.
@reinerluke97 , @FnnHuman
I could not see a folder named ‘build’ inside platforms/android/ .
I already added android platform
I waited upto stop the processing … unused ‘variable’ or unused ‘import’ is a problem ?
Thanks
Anes
Can you post the whole output when you run ionic cordova build android --prod
?
Not just screenshots but the actual text.
The problem is that we dont get any good information. No Error Messages? Or anything?
Becaus there are hundrets of reasons why you cant build your Application.
Maybe Errors in Code?
Maybe a failed installation of Android Platform?
Envrioment Errors?
Please do this to maybe detect something serios:
ionic doctor check
Sure my entire command is
user@acer:~/dreamhouse-mobile-ionic$ ionic cordova build android --prod
? Detected HTTPS_PROXY in environment, but to proxy CLI requests, you'll need @ionic/cli-plugin-proxy installed. Install now? No
Running app-scripts build: --prod
[14:32:33] build prod started ...
[14:32:33] clean started ...
[14:32:33] clean finished in 29 ms
[14:32:33] copy started ...
[14:32:33] ngc started ...
[14:32:49] ngc finished in 15.12 s
[14:32:49] preprocess started ...
[14:32:49] deeplinks started ...
[14:32:49] deeplinks finished in 485 ms
[14:32:49] optimization started ...
[14:32:49] copy finished in 15.86 s
[14:33:03] optimization finished in 13.77 s
[14:33:03] preprocess finished in 14.26 s
[14:33:03] webpack started ...
[14:33:11] webpack finished in 8.29 s
[14:33:11] sass started ...
[14:33:11] uglifyjs started ...
[14:33:14] sass finished in 2.93 s
[14:33:14] cleancss started ...
[14:33:16] cleancss finished in 2.32 s
[14:33:28] uglifyjs finished in 17.24 s
[14:33:28] postprocess started ...
[14:33:29] postprocess finished in 62 ms
[14:33:29] lint started ...
[14:33:29] build prod finished in 55.12 s
> ionic cordova prepare
✔ cordova prepare - done!
Android Studio project detected
[14:33:33] tslint: src/pages/pay/pay.ts, line: 48
Unused variable: 'pageContentUrl'
L47: '</form> <script type="text/javascript">document.getElementById("loginForm").submit();</script></body></html>';
L48: var pageContentUrl = 'data:text/html;base64,' + btoa(pageContent);
L49: /*var browserRef = window.open(
[14:33:33] lint finished in 4.30 s
✔ cordova build android - done!
Android Studio project detected
user@acer:~/dreamhouse-mobile-ionic$
Only warning is non-used variable …
Two things to try, remove the platforms/android directory and try to build again.
If that doesn’t work, can you at least open ‘Android Studio’ just to make sure that’s working at all?
Yes and after that also check if you installed at least 1 Android Platform (full) in your Android SDK (you can open it within the Android Studio)
I tried by removing it. i deleted android folder inside platforms. It created by build process.
‘Android studio’ also work fine … but no apk build any where
The the Error is somewhere in your Code.
Try to create a new App and build it. If it works you at least know your Error is in your Code.
Just to prove-disprove your code is good…
Set up another ionic project ionic start AnotherProject
Try creating an APK with that instead. That’ll prove-disprove any config / coding issues in your own app.
Ho @Judgewest2000,
Created new Demo app , tried same thing still same effeect as
user@acer:~/demo$ ionic cordova build android
Running app-scripts build:
[15:51:03] build dev started ...
[15:51:03] clean started ...
[15:51:03] clean finished in 50 ms
[15:51:03] copy started ...
[15:51:03] deeplinks started ...
[15:51:03] deeplinks finished in 30 ms
[15:51:03] transpile started ...
[15:51:11] transpile finished in 8.27 s
[15:51:11] preprocess started ...
[15:51:11] preprocess finished in less than 1 ms
[15:51:11] webpack started ...
[15:51:12] copy finished in 9.61 s
[15:51:24] webpack finished in 12.04 s
[15:51:24] 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.
[15:51:26] sass finished in 2.93 s
[15:51:26] postprocess started ...
[15:51:27] postprocess finished in 61 ms
[15:51:27] lint started ...
[15:51:27] build dev finished in 23.93 s
> ionic cordova prepare
⠼ cordova prepare [15:51:54] lint finished in 27.94 s
✔ cordova prepare - done!
Android Studio project detected
✔ cordova build android - done!
Android Studio project detected
user@acer:~/demo$
Please advise
Thanks
Anes
There is no command with same name , got error
[ERROR] Unable to find command: doctor check
There is a config issue with your computer.
Are you able to manually open Android Studio? If so you should be able to open the project and run it at the very least. Try that.
It’ll be something like a missing PATH or something.
Also the more recent post of yours, are you actually running ionic doctor check
?
Yes I just run because i need a solution …
I am using Ubuntu 16.04 … My /etc/environment configuration is:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-8-openjdk-amd64/bin"
http_proxy="http://172.16.8.4:8080/"
https_proxy="https://172.16.8.4:8080/"
ftp_proxy="ftp://172.16.8.4:8080/"
socks_proxy="socks://172.16.8.4:8080/"
ANDROID_HOME="/home/user/Android/Sdk"
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
Please advise anything wrong…
Thanks
Anes
According to my Friend Bhagynath I tried command as below:
user@acer:~/demo$ ionic cordova run android
Running app-scripts build:
[16:50:53] build dev started ...
[16:50:53] clean started ...
[16:50:53] clean finished in 4 ms
[16:50:53] copy started ...
[16:50:53] deeplinks started ...
[16:50:53] deeplinks finished in 28 ms
[16:50:53] transpile started ...
[16:50:58] transpile finished in 4.91 s
[16:50:58] preprocess started ...
[16:50:58] preprocess finished in 1 ms
[16:50:58] webpack started ...
[16:50:58] copy finished in 5.11 s
[16:51:07] webpack finished in 9.15 s
[16:51:07] 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.
[16:51:09] sass finished in 1.55 s
[16:51:09] postprocess started ...
[16:51:09] postprocess finished in 9 ms
[16:51:09] lint started ...
[16:51:09] build dev finished in 15.76 s
> ionic cordova prepare
✔ cordova prepare - done!
Android Studio project detected
> cordova run android
Android Studio project detected
ANDROID_HOME=/home/user/Android/Sdk
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
studio
(node:3954) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
(node:3954) [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.
[16:51:13] lint finished in 4.62 s
[OK] Your app has been deployed.
Did you know you can live-reload changes from your app with --livereload?
Still I could not find an apk I intended to build. My demo app is simple one there is no code edit i am done yet …
Thanks
Anes
Seems you dont have Installed Android Studio with correct Permissions or something?
Ionic tried to install the gradle wrapper (which is needed to build an APK) because it couldnt find one on your Envrioment.
Error: Promise Rejection. Which means that something with your Permissions is wrong.
Either on your Envrioment or either with your Ionic or Android SDK.
Does Ionic have the Permission to install something on your Envrioment?
Dear Reiner,
I have no idea regarding ionic have permission or not . How it can check ? If I manually install Gradle will fix this issue ? please advise
Thanks
Anes
Dear Reiner,
I have no idea regarding ionic have permission or not . How it can check ? If I manually install Gradle will fix this issue ? please adviseThanks
Anes
Try installing gradle and include it into your path.
It has a tutorial how to do it in Linux.
Another Method would be:
sudo apt install gradle
Also here is someone who had the same problem and sloved it with this method:
Cheers