Build APK successful but no apk found and build directory did not found too


#1

ionic cordova build --release android
Running app-scripts build: --platform android --target cordova
[09:43:08] build dev started …
[09:43:08] clean started …
[09:43:08] clean finished in 7 ms
[09:43:08] copy started …
[09:43:09] deeplinks started …
[09:43:09] deeplinks finished in 86 ms
[09:43:09] transpile started …
[09:43:12] transpile finished in 3.08 s
[09:43:12] preprocess started …
[09:43:12] preprocess finished in 1 ms
[09:43:12] webpack started …
[09:43:12] copy finished in 3.42 s
[09:43:17] webpack finished in 4.84 s
[09:43:17] 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.
[09:43:17] sass finished in 799 ms
[09:43:17] postprocess started …
[09:43:17] postprocess finished in 11 ms
[09:43:17] lint started …
[09:43:17] build dev finished in 9.03 s

cordova build android --release
will push strings array {“name”:“lang”,“titles”:[“English (US)”,“English (UK)”],“values”:[“en-us”,“en-gb”]}
android preferences file was successfully generated
ANDROID_HOME=D:\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_25
Subproject Path: CordovaLib
[09:43:20] lint finished in 2.40 s
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.

    at build_4grcbz3p2woag1vnrvv8dmgtu.run(D:\INDAKO\IONIC\MyProject1\platforms\android\build.gradle:141)

publishNonDefault is deprecated and has no effect anymore. All variants are now published.

:preBuild
UP-TO-DATE
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preReleaseBuild UP-TO-DATE
:CordovaLib:checkReleaseManifest

UP-TO-DATE
:CordovaLib:processReleaseManifest

UP-TO-DATE
:preReleaseBuild

UP-TO-DATE
:CordovaLib:compileReleaseAidl UP-TO-DATE
:compileReleaseAidl UP-TO-DATE
:CordovaLib:packageReleaseRenderscript
NO-SOURCE
:compileReleaseRenderscript

UP-TO-DATE
:checkReleaseManifest UP-TO-DATE
:generateReleaseBuildConfig UP-TO-DATE
:prepareLintJar UP-TO-DATE
:generateReleaseResValues
UP-TO-DATE
:generateReleaseResources UP-TO-DATE
:CordovaLib:compileReleaseRenderscript UP-TO-DATE
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources
UP-TO-DATE
:mergeReleaseResources
UP-TO-DATE
:createReleaseCompatibleScreenManifests
UP-TO-DATE
:processReleaseManifest UP-TO-DATE
:splitsDiscoveryTaskRelease UP-TO-DATE
:CordovaLib:platformAttrExtractor

UP-TO-DATE
:CordovaLib:processReleaseResources

UP-TO-DATE
:processReleaseResources UP-TO-DATE
:generateReleaseSources UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig

UP-TO-DATE
:CordovaLib:prepareLintJar UP-TO-DATE
:CordovaLib:generateReleaseSources UP-TO-DATE
:CordovaLib:javaPreCompileRelease UP-TO-DATE
:CordovaLib:compileReleaseJavaWithJavac

UP-TO-DATE
:CordovaLib:processReleaseJavaRes NO-SOURCE
:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease

UP-TO-DATE
:javaPreCompileRelease UP-TO-DATE
:compileReleaseJavaWithJavac
UP-TO-DATE

:compileReleaseNdk

NO-SOURCE
:compileReleaseSources UP-TO-DATE
:mergeReleaseShaders UP-TO-DATE
:compileReleaseShaders UP-TO-DATE
:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseShaders UP-TO-DATE
:CordovaLib:compileReleaseShaders
UP-TO-DATE

:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets UP-TO-DATE
:mergeReleaseAssets

:transformClassesWithPreDexForRelease

UP-TO-DATE
:transformDexWithDexForRelease

UP-TO-DATE
:mergeReleaseJniLibFolders UP-TO-DATE
:CordovaLib:compileReleaseNdk NO-SOURCE
:CordovaLib:mergeReleaseJniLibFolders
UP-TO-DATE
:CordovaLib:transformNativeLibsWithMergeJniLibsForRelease UP-TO-DATE
:CordovaLib:transformNativeLibsWithIntermediateJniLibsForRelease
UP-TO-DATE
:transformNativeLibsWithMergeJniLibsForRelease UP-TO-DATE
:processReleaseJavaRes
NO-SOURCE
:transformResourcesWithMergeJavaResForRelease

UP-TO-DATE
:packageRelease

:lintVitalRelease

:assembleRelease
:cdvBuildRelease

BUILD SUCCESSFUL in 4s
43 actionable tasks: 3 executed, 40 up-to-date
Built the following apk(s):

#####################################################
ionic info

cli packages: (C:\Users\Djatipoetra\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.1.8
Cordova Platforms  : android 6.4.0
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v8.5.0
npm               : 5.8.0
OS                : Windows 10

Environment Variables:

ANDROID_HOME : D:\sdk

Misc:

backend : pro

is the any problem. i’m using windows7.


#2

After Built the following apk(s), cmd shows you the path to apk like

D:\Projects*****\platforms\android\app\build\outputs\apk\debug\app-debug.apk for cordova android 7+

for lower version of android, it’s like

D:\Projects*****\platforms\android\build\outputs\apk\android-debug.apk


#3

BUILD SUCCESSFUL in 4s
43 actionable tasks: 3 executed, 40 up-to-date
Built the following apk(s):

i cannot find build folder in Platform\android\ directory
is there any problem ?


#4

Your projects are in any place where the path has spaces??


#5

I think it should be in platforms/android/app/build/outputs/apk/release

As you have used ionic cordova build --release


#6

Try run your project
ionic cordova run android


#7

my project path dont have any space.


#8

ionic cordova run android
Running app-scripts build: --platform android --target cordova
[15:58:10] build dev started …
[15:58:10] clean started …
[15:58:10] clean finished in 8 ms
[15:58:10] copy started …
[15:58:10] deeplinks started …
[15:58:11] deeplinks finished in 92 ms
[15:58:11] transpile started …
[15:58:15] transpile finished in 4.93 s
[15:58:15] preprocess started …
[15:58:15] preprocess finished in 1 ms
[15:58:15] webpack started …
[15:58:16] copy finished in 6.12 s
[15:58:22] webpack finished in 6.81 s
[15:58:22] 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:58:24] sass finished in 1.69 s
[15:58:24] postprocess started …
[15:58:24] postprocess finished in 12 ms
[15:58:24] lint started …
[15:58:24] build dev finished in 14.38 s

cordova run android
will push strings array {“name”:“lang”,“titles”:[“English (US)”,“English (UK)”],“values”:[“en-us”,“en-gb”]}
android preferences file was successfully generated
[15:58:27] lint finished in 2.74 s
ANDROID_HOME=D:\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_25
Subproject Path: CordovaLib
Starting a Gradle Daemon, 1 busy and 3 incompatible and 1 stopped Daemons could not be reused, use --status for details

The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_4grcbz3p2woag1vnrvv8dmgtu.run(D:\INDOKA\IONIC\MyProject1\platforms\android\build.gradle:141)
publishNonDefault is deprecated and has no effect anymore. All variants are now published.

:preBuild
UP-TO-DATE
:CordovaLib:preBuild
UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest

UP-TO-DATE
:CordovaLib:processDebugManifest

UP-TO-DATE
:preDebugBuild

UP-TO-DATE
:CordovaLib:compileDebugAidl
UP-TO-DATE

:compileDebugAidl

UP-TO-DATE
:CordovaLib:packageDebugRenderscript
NO-SOURCE

:compileDebugRenderscript
UP-TO-DATE

:checkDebugManifest

UP-TO-DATE
:generateDebugBuildConfig
UP-TO-DATE

:prepareLintJar UP-TO-DATE
:generateDebugResValues
UP-TO-DATE
:generateDebugResources UP-TO-DATE
:CordovaLib:compileDebugRenderscript

UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources
UP-TO-DATE

:mergeDebugResources

:createDebugCompatibleScreenManifests
UP-TO-DATE

:processDebugManifest
UP-TO-DATE

:splitsDiscoveryTaskDebug
UP-TO-DATE

:CordovaLib:platformAttrExtractor
UP-TO-DATE

:CordovaLib:processDebugResources
UP-TO-DATE
:processDebugResources

:generateDebugSources
:CordovaLib:generateDebugBuildConfig

UP-TO-DATE
:CordovaLib:prepareLintJar
UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:javaPreCompileDebug

UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac

UP-TO-DATE
:CordovaLib:processDebugJavaRes NO-SOURCE
:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
UP-TO-DATE

:javaPreCompileDebug
UP-TO-DATE

:compileDebugJavaWithJavac
UP-TO-DATE

:compileDebugNdk NO-SOURCE
:compileDebugSources UP-TO-DATE
:mergeDebugShaders
UP-TO-DATE
:compileDebugShaders UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugShaders
UP-TO-DATE
:CordovaLib:compileDebugShaders
UP-TO-DATE

:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:mergeDebugAssets

:transformClassesWithDexBuilderForDebug
UP-TO-DATE

:transformDexArchiveWithExternalLibsDexMergerForDebug
UP-TO-DATE

:transformDexArchiveWithDexMergerForDebug
UP-TO-DATE

:mergeDebugJniLibFolders
UP-TO-DATE
:CordovaLib:compileDebugNdk NO-SOURCE
:CordovaLib:mergeDebugJniLibFolders
UP-TO-DATE

:CordovaLib:transformNativeLibsWithMergeJniLibsForDebug
UP-TO-DATE

:CordovaLib:transformNativeLibsWithIntermediateJniLibsForDebug UP-TO-DATE
:transformNativeLibsWithMergeJniLibsForDebug
UP-TO-DATE

:processDebugJavaRes
NO-SOURCE

:transformResourcesWithMergeJavaResForDebug
UP-TO-DATE

:validateSigningDebug

:packageDebug

:assembleDebug
:cdvBuildDebug

BUILD SUCCESSFUL in 52s
44 actionable tasks: 5 executed, 39 up-to-date
Built the following apk(s):

ANDROID_HOME=D:\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_25
No target specified and no devices found, deploying to emulator

(node:5296) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): [object Object]
(node:5296) [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.

[OK] Your app has been deployed.
Did you know you can live-reload changes from your app with --livereload?

D:\INDOKA\IONIC\MyProject1>


#9

Hi@h4t4k4
If you want debug build try this

ionic cordova build android --prod

or for release build

ionic cordova build android --prod

Check the location inside
Your Project-->Platforms-->android--->build---->outputs--->apk
Otherwise add platform before taking build

ionic cordova platform add android

#10


#11

there is no “Build” folder after execute ionic cordova build android --prod. is there anything wrong?


#12

@h4t4k4 Is this ionic latest project?
Can you post your ionic info?


#13

D:\INDOKA\IONIC\MyProject1>ionic info

cli packages: (C:\Users\Djatipoetra\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.1.8
Cordova Platforms  : android 6.4.0
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v8.5.0
npm               : 5.8.0
OS                : Windows 10

Environment Variables:

ANDROID_HOME : D:\sdk

Misc:

backend : pro

D:\INDOKA\IONIC\MyProject1>


#14

@h4t4k4 I think the issue is with your platform added.If you are added platform already,
remove it and add again

ionic cordova platform remove android
ionic cordova platform add android

#15

D:\INDOKA\IONIC\MyProject1>ionic cordova platform remove android

cordova platform remove android --save
Removing platform android from config.xml file…

Removing android from cordova.platforms array in package.json

D:\INDOKA\IONIC\MyProject1>ionic cordova platform add android

cordova platform add android --save
Using cordova-fetch for cordova-android@~7.0.0

Adding android project…
(node:1692) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ENOENT: no such file or directory, open ‘D:\INDOKA\IONIC\MyProject1\platforms\android\src\me\apla\cordova\AppPreferencesActivity.java’
(node:1692) [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.

Creating Cordova project for the Android platform:
Path: platforms\android
Package: io.ionic.starter
Name: MyProject1
Activity: MainActivity
Android target: android-26
Subproject Path: CordovaLib
Subproject Path: app
Android project created with cordova-android@7.0.0
Android Studio project detected
Android Studio project detected
Installing “cordova-plugin-app-preferences” for android
unhandled exception { Error: ENOENT: no such file or directory, open ‘D:\INDOKA\IONIC\MyProject1\platforms\android\src\me\apla\cordova\AppPreferencesActivity.java’
errno: -4058,
code: ‘ENOENT’,
syscall: ‘open’,
path: ‘D:\INDOKA\IONIC\MyProject1\platforms\android\src\me\apla\cordova\AppPreferencesActivity.java’ }
Failed to install ‘cordova-plugin-app-preferences’: Error: ENOENT: no such file or directory, open ‘D:\INDOKA\IONIC\MyProject1\platforms\android\src\me\apla\cordova\AppPreferencesActivity.java’

ionic cordova resources android --force
√ Collecting resource configuration and source images - done!
√ Filtering out image resources that do not need regeneration - done!
√ Uploading source images to prepare for transformations - done!
√ Generating platform resources: 18 / 18 complete - done!
√ Modifying config.xml to add new image resources - done!

D:\INDOKA\IONIC\MyProject1>

is there anything wrong ?


#16

@h4t4k4
Now try to build your app


#17

ionic cordova build --release android --prod
Running app-scripts build: --prod --platform android --target cordova
[16:50:25] build prod started …
[16:50:25] clean started …
[16:50:25] clean finished in 5 ms
[16:50:25] copy started …
[16:50:25] deeplinks started …
[16:50:25] deeplinks finished in 69 ms
[16:50:25] ngc started …
Warning: Can’t resolve all parameters for Settings in D:/INDOKA/IONIC/MyProject1/src/providers/settings/settings.ts: ([object Object], ?). This will become an error in Angular v6.x
Warning: Can’t resolve all parameters for Settings in D:/INDOKA/IONIC/MyProject1/src/providers/settings/settings.ts: ([object Object], ?). This will become an error in Angular v6.x
[16:50:31] ngc finished in 6.28 s
[16:50:31] preprocess started …
[16:50:31] preprocess finished in less than 1 ms
[16:50:31] webpack started …
[16:50:31] copy finished in 6.67 s
[16:50:57] webpack finished in 26.11 s
[16:50:57] uglify started …
[16:50:57] 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:50:58] sass finished in 819 ms
[16:50:58] cleancss started …
[16:50:59] cleancss finished in 1.18 s
[16:51:10] uglify finished in 12.80 s
[16:51:10] postprocess started …
[16:51:10] postprocess finished in 32 ms
[16:51:10] lint started …
[16:51:10] build prod finished in 45.39 s

cordova build android --release
Android Studio project detected

will push strings array {“name”:“lang”,“titles”:[“English (US)”,“English (UK)”],“values”:[“en-us”,“en-gb”]}
unhandled exception { Error: ENOENT: no such file or directory, mkdir ‘D:\INDOKA\IONIC\MyProject1\platforms\android\res\xml’
errno: -4058,
code: ‘ENOENT’,
syscall: ‘mkdir’,
path: ‘D:\INDOKA\IONIC\MyProject1\platforms\android\res\xml’ }
(node:4568) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ENOENT: no such file or directory, mkdir ‘D:\INDOKA\IONIC\MyProject1\platforms\android\res\xml’
(node:4568) [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 2.55 s

D:\INDOKA\IONIC\MyProject1>

there is any error but i dont understand what its means?


#18

@h4t4k4
Remove your node modules
rm -rf node_modules
and try
npm install