简体   繁体   中英

ionic build android : No APK file generated in Ionic 2

I just executed the command "ionic build android" on my ionic 2 project and it was done successfully it says. But there is no APK file generated. What am I supposed to do? Thanks in advance. I'm using node v6.11.2, Ionic CLI 3.7.0, cordova 7.0.1.

首先在ionic Io上创建一个帐户,然后在登录成功后将您在云中的apk文件存储成功并下载并安装后,在项目目录中单击此ionic Io init,然后在项目目录中单击此ion Io init

Follow this steps

  1. Run ionic cordova build --release android
  2. Open android studio go to Build -> Generate Signed APK, press next
  3. If you don't have Key store please create new one
  4. Finish

you can find the APK under Platforms/android

The Path as mentioned before is the correct path to find your generated apk file.

yourProject/platforms/android/build/outputs/apk/android-rele‌​ase-unsigned.apk

Please check these steps if there something missing.

I. Development environment dependencies

1)You need at Least to download a java JDK 8

2)Download an Android SDK manager

3)you must Add them to the environment variables

(Windows)

i)Open environment variables

ii)ANDROID_HOME:create a new user variable with name ANDROID_HOME and add the path of the SDK manager ex.C:\\xxx\\Android\\sdk

iii)edit the user variable PATH value and add to it platform tools path ex. C:\\xxx\\Android\\sdk\\platform-tools

iV)JAVA_HOME:Don't forget also to edit in the user variable PATH, your old JAVA_HOME env path with the new JDK Path . ex.C:\\Program Files\\Java\\jdk1.8.0_144

4)Globally install ionic and cordova

npm install -g ionic cordova

II. Ionic CLI for build android

5) ionic cordova platform add android

6) ionic cordova build android

NB: there sometimes logging in issue through CLI when using this command, the next steps doesn't really make sense but it worked for me.

ionic config set backend pro -g

Retry the build process again ,if Still there a problem change to legacy and Then again back to pro

ionic config set backend legacy -g

ionic config set backend pro -g

It should work now, retry the build process again.

If still there a problem then make an app through the website of ionic use this command with the --pro-id of your app and retry again.

ionic start --pro-id <ID>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM