App build: APK and build-folder missing

Hi,
currently I try to build my app. I am using “ionic cordova build android” in node.js. It is building the app and creating the android folder in “count/platforms/android” with some content.
build
According to the ionic documentation, there should be a folder called “build” which contains the APK, but it is missing.
If you have any ideas what the problem is, I would be thankfully for help.

Greetings,

Robert

Which cordova-android version are you using?

With version >= 7, the apk are now “delivered” under

 ./platforms/android/app/build/outputs/apk/debug/

or

./platforms/android/app/build/outputs/apk/release/
1 Like

Hi,
thanks for you reply. I am using 7.0.0.

When I am following your path, I can only follow until

./platforms/android/app/
because since there, the rest of the path is missing.

When I export the app, the console shows:

(node:2224) 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\Robert\count\platforms\android\cordova\lib\check_reqs.js:305:19
at _fulfilled (C:\Users\Robert\count\platforms\android\cordova\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\Users\Robert\count\platforms\android\cordova\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\Users\Robert\count\platforms\android\cordova\node_modules\q\q.js:816:13)
at C:\Users\Robert\count\platforms\android\cordova\node_modules\q\q.js:877:14
at runSingle (C:\Users\Robert\count\platforms\android\cordova\node_modules\q\q.js:137:13)
at flush (C:\Users\Robert\count\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)
at Function.Module.runMain (module.js:695:11)
(node:2224) 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:2224) [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.

I dont know whether this is a problem because in the end it has no error message, but obviously the APK is missing, as well as the entire build folder.

Am I using the wrong command for building an APK??

Edit: I have also tried to export an other app. using “ionic cordova build android” with the same result: no build-folder or APK

Well according the stack there is an error that’s why you didn’t find any apk respectively the build wasn’t complete

Don’t have the solution right here (browse the forum for the ANDROID_HOME not defined), but spontaneously I would say that android studio has to be installed or if this is done you should “just” add the path to your environment something like that

1 Like

I downloaded Android Studium, but if I try to build the app it still isn´t doing it. Also concerning gradle, I dont think it is being downloaded when I launch “ionic build --release”. Do you know how to solve this??

I found this tutorial and at 6:53 he is using “ionic build android --release” and it downloads some stuff, what mine isn´t doing.:


Might this be the problem and if so, how can I solve it??

Android studio is not configured properly. Follow a tutorial on how to install it and the correct SDK.

Before you try to build with ionic command, build it and run in android studio first.

1 Like

From Android studio v3, Gradle need to be installed separately too

About --release, I would suggest, first try to build a debug apk without this specific --release command. Once you succeed then try to sign your apk. Respectively

ionic cordova build android --prod

then when ok

ionic cordova build android --prod --release
1 Like

How do I open my app in android studio?? Wrote it with notepad++ but don´t find an option to open it…
About SDK: the android studio sdk manager looks like this:

But if I try to run it, I still get this error:

(node:1576) UnhandledPromiseRejectionWarning: CordovaError: Requirements check failed for JDK 1.8 or greater
at C:\Users\Robert\count\platforms\android\cordova\lib\check_reqs.js:370:19
at _fulfilled (C:\Users\Robert\count\platforms\android\cordova\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\Users\Robert\count\platforms\android\cordova\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\Users\Robert\count\platforms\android\cordova\node_modules\q\q.js:816:13)
at C:\Users\Robert\count\platforms\android\cordova\node_modules\q\q.js:624:44
at runSingle (C:\Users\Robert\count\platforms\android\cordova\node_modules\q\q.js:137:13)
at flush (C:\Users\Robert\count\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:1576) 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:1576) [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.

It also still doesnt build…gradle is installed as well (if I check in console for “gradle --version” I receive

"Gradle 4.7

Build time: 2018-04-18 09:09:12 UTC
Revision: b9a962bf70638332300e7f810689cb2febbd4a6c
Groovy: 2.4.12
Ant: Apache Ant™ version 1.9.9 compiled on February 2 2017
JVM: 10.0.1 (“Oracle Corporation” 10.0.1+10)
OS: Windows 10 10.0 amd64"

Any other ideas how to check what is wrong or how to fix it??

Try to search the forum for a solution to that error, this was reported many times

P.S.: About your Android SDK, as fas as I know, it’s not mandatory to have all SDK installed

1 Like

Step 1:
You don’t have JDK 1.8 or above installed. Google search JDK 1.8 and download from java website.

Step2:
To open your project in android studio you open the android folder under the platforms folder within your project. So open android studio, then click the open option. Navigate to the folder where u have your project, then go to the platforms folder, then double click android. Android studio will begin to import the project and update the gradle.

2 Likes

I am incredible thankfully, its finally working!

Thank you guys! :blush:

2 Likes