Build done but could not see apk .why?


#21

Dear Reiner,

I tried the manual method described here : Gradle installation first but no output

Then

I tried your simple method of

sudo apt install gradle

which work fine . But on build it give hope in initial 3 minutes , but failed with messages


:app:compileDebugJavaWithJavac
/home/user/dreamhouse-mobile-ionic/platforms/android/app/src/main/java/com/alexdisler/inapppurchases/IabHelper.java:33: error: package com.android.vending.billing does not exist
import com.android.vending.billing.IInAppBillingService;
                                  ^
/home/user/dreamhouse-mobile-ionic/platforms/android/app/src/main/java/com/alexdisler/inapppurchases/IabHelper.java:103: error: cannot find symbol
    IInAppBillingService mService;
    ^
  symbol:   class IInAppBillingService
  location: class IabHelper
/home/user/dreamhouse-mobile-ionic/platforms/android/app/src/main/java/com/alexdisler/inapppurchases/IabHelper.java:230: error: package IInAppBillingService does not exist
                mService = IInAppBillingService.Stub.asInterface(service);
                                               ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 errors
 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 3m 48s
27 actionable tasks: 27 executed
(node:7104) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: /home/user/dreamhouse-mobile-ionic/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/home/user/dreamhouse-mobile-ionic/platforms/android/app/src/main/java/com/alexdisler/inapppurchases/IabHelper.java:33: error: package com.android.vending.billing does not exist
import com.android.vending.billing.IInAppBillingService;
                                  ^
/home/user/dreamhouse-mobile-ionic/platforms/android/app/src/main/java/com/alexdisler/inapppurchases/IabHelper.java:103: error: cannot find symbol
    IInAppBillingService mService;
    ^
  symbol:   class IInAppBillingService
  location: class IabHelper
/home/user/dreamhouse-mobile-ionic/platforms/android/app/src/main/java/com/alexdisler/inapppurchases/IabHelper.java:230: error: package IInAppBillingService does not exist
                mService = IInAppBillingService.Stub.asInterface(service);
                                               ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 3m 48s
(node:7104) [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.

One new positive change occur is in ‘platforms/android’ folder a ‘build’ directory and inside it an ‘android-profile’ folder created with one json file and another file created.

Please advise where we lose the target …

Waiting your reply

Thanks

Anes


#22

latest output is

user@acer:~/demo$ ionic cordova run android
Running app-scripts build: 

[20:21:11]  build dev started ... 
[20:21:11]  clean started ... 
[20:21:11]  clean finished in 3 ms 
[20:21:11]  copy started ... 
[20:21:11]  deeplinks started ... 
[20:21:12]  deeplinks finished in 28 ms 
[20:21:12]  transpile started ... 
[20:21:16]  transpile finished in 4.85 s 
[20:21:16]  preprocess started ... 
[20:21:16]  preprocess finished in less than 1 ms 
[20:21:16]  webpack started ... 
[20:21:16]  copy finished in 5.05 s 
[20:21:26]  webpack finished in 9.22 s 
[20:21:26]  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.
[20:21:27]  sass finished in 1.57 s 
[20:21:27]  postprocess started ... 
[20:21:27]  postprocess finished in 8 ms 
[20:21:27]  lint started ... 
[20:21:27]  build dev finished in 15.79 s 
> ionic cordova prepare
⠴ cordova prepare [20:21:31]  lint finished in 3.96 s 
✔ 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
Subproject Path: CordovaLib
Subproject Path: app
(node:9025) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: spawn EACCES
(node:9025) [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.

any body please advise

Thanks

Anes


#23

Friends.
on production build using command

ionic cordova build android --prod --verbose

shows

[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: '/home/user/demo', local: false, binPath: 
        '/usr/lib/node_modules/ionic/bin/ionic', libPath: 
        '/usr/lib/node_modules/ionic/dist/index.js' }
[DEBUG] Loading global plugin @ionic/cli-plugin-proxy
[DEBUG] Latest plugin version of @ionic/cli-plugin-proxy is unknown, according 
        to daemon file.
Running app-scripts build: --prod

[06:41:01]  build prod started ... 
[06:41:01]  clean started ... 
[06:41:01]  clean finished in 2 ms 
[06:41:01]  copy started ... 
[06:41:01]  deeplinks started ... 
[06:41:01]  deeplinks finished in 28 ms 
[06:41:01]  ngc started ... 
[06:41:11]  ngc finished in 9.72 s 
[06:41:11]  preprocess started ... 
[06:41:11]  preprocess finished in 1 ms 
[06:41:11]  webpack started ... 
[06:41:11]  copy finished in 10.04 s 
[06:41:51]  webpack finished in 40.87 s 
[06:41:51]  uglify started ... 
[06:41:51]  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.
[06:41:54]  sass finished in 2.73 s 
[06:41:54]  cleancss started ... 
[06:41:57]  cleancss finished in 2.78 s 
[06:42:12]  uglify finished in 20.46 s 
[06:42:12]  postprocess started ... 
[06:42:12]  postprocess finished in 30 ms 
[06:42:12]  lint started ... 
[06:42:12]  build prod finished in 71.23 s 
> ionic cordova prepare
✔ cordova prepare - done!
Android Studio project detected
⠹ cordova build android [06:42:16]  lint finished in 4.39 s 
✔ cordova build android - done!
Android Studio project detected
ANDROID_HOME=/home/user/Android/Sdk
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
studio
Subproject Path: CordovaLib
Subproject Path: app

without any apk build. Please advise I am looking same for 2 days.

Thanks

Anes


#24

try to run your project direct on android device via usb cable connection

use this command

ionic cordova run [<platform>]

it will directly create apk file and install it in device


#25

Dear @hirenkorat3,

I manage to generate apk using command

ionic cordova run android

. The problem is in a plugin named ‘cordova-plugin-inapppurchase’.
By removing same I can generate ‘debug’ apk. But now my problem is when I create using production version using command

ionic cordova build android --prod --release

it work and generate apk named ‘app-release-unsigned.apk’.

I can install and run debug apk in my mobile , but could not install this ‘app-release-unsigned.apk’ showing ‘app not installed’ message …

Please advise what I am wrong with …

Thanks

Anes


#26

have your app already installed in your device and you try to install then it will show error ?


#27

I removed all and try to install then also same error …but debug apk works fine …


#28

please share your ionic info


#29

oh god I get some error when try it
user@acer:~/dreamhouse-mobile-ionic$ ionic info
:heavy_multiplication_x: Gathering environment info - failed!
TypeError: Cannot read property ‘startsWith’ of undefined

Why this ?


#30

If you get an Error at ionic info something with your installation is wrong.

Please reinstall IONIC, Cordova and Android properly and then give us your ionic info.
Also if you installed all correctly you can try a ionic cordova build android again.


#31

Project --> platform --> android --> app --> release --> app.release.apk


#32

“startsWith” could not work in lowest version browser… So use “indexOf” …


#33

Dear Rein,

Accidently i allow upgrade and now i got error as

bash: /usr/bin/ionic: No such file or directory

Please help .

I installed old version , but still the problem

My OS is ubuntu 16.04


#34

By the flag --release, you are generating an unsigned version of apk which can be uploaded in Google Play Store.

But before that, you need to SIGN IT with your developer certifiate(which you can create).
Follow official guide for signing and publishing apps.

After signing, you can install it in any your Android devices.


#35

i have same error while using node 8 or greater.
but when i’m downgrade to node version 6.12.3 work fine for me.
maybe you can try this.
i hope this help thanks.


#36

Please change your gradle path in your project


#37

For anyone else who is looking for their build output in this folder, for me in ionic 4 the new default file location is /platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk.