我打包发布ionic2 APP正式版的步骤

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

                       

目录

这里进行记录,方便查找:

Android平台的apk打包

  针对Android平台来说:
  旧的(这个操作不太正确,或者说不太好,误导大家了,尴尬):

cordova plugin rm cordova-plugin-consolecordova build --release androidcd platformscd androidcd buildcd outputscd apkjarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -tsa https://timestamp.geotrust.com/tsa -keystore my-release-key.keystore android-release-unsigned.apk wanchettzipalign -v 4 android-release-unsigned.apk WanCheTT.apk
   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

  新的(2017-02-23):

cordova plugin rm cordova-plugin-consoleionic build android --release --prod --device -- --keystore="../android.keystore" --storePassword=android --alias=mykey --password=myKeyPasswordcd platformscd androidcd buildcd outputscd apkzipalign -v 4 android-release.apk WanCheTT.apk// 或者直接(将在项目的根目录下生存WanCheTT.apk)zipalign -v 4 ./platforms/android/build/outputs/apk/android-release.apk WanCheTT.apk
   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

  其中 ionic build android –prod –device 中的 –prod 表示启用aot;–device 将要求略过白屏启动时间。
  打包好APP后,还需要对APP进行加固。可以使用“乐固”,通过“乐固”进行加固后,下载加固后的安装包,重新进行签名即可。

iOS平台生成构建版本的注意事项

Xcode8 iOS App上传详细流程
- 调试过程中 product -》 scheme -》edit scheme  run 为 debug;发布时改为release;
- APP中有推送功能的话,注意开启 推送 功能(使用XCode打开项目进行配置);
- 考虑设置APP是否允许横屏显示;
- 在info.list处添加权限的说明: iOS-Xcode上传后iTunes Connect构建版本不显示

Android平台的具体参考:

Publishing your app

  Now that we have a working app, we are ready to push it live to the world! Since the Ionic team already submitted the Todo app from this guide to the app store, chances are you’ll want to follow this chapter with a new app that you make on your own.
  So first, we need to generate a release build of our app, targeted at each platform we wish to deploy on. Before we deploy, we should take care to adjust plugins needed during development that should not be in production mode. For example, we probably don’t want the debug console plugin enabled, so we should remove it before generating the release builds:

$ cordova build --release android
   
   
  • 1

  This will generate a release build based on the settings in your config.xml. Your Ionic app will have preset default values in this file, but if you need to customize how your app is built, you can edit this file to fit your preferences. Check out the config.xml file documentation for more information.
  Next, we can find our platforms/android/build/outputs/apk. In our example, the file was platforms/android/build/outputs/apk/HelloWorld-release-unsigned.apk. Now, we need to sign the unsigned APK and run an alignment utility on it to optimize it and prepare it for the app store. If you already have a signing key, skip these steps and use that one instead.
  Let’s generate our private key using the keytool command that comes with the JDK. If this tool isn’t found, refer to the installation guide:

$ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
   
   
  • 1

  You’ll first be prompted to create a password for the keystore. Then, answer the rest of the nice tools’s questions and when it’s all done, you should have a file called my-release-key.keystore created in the current directory.
  Note: Make sure to save this file somewhere safe, if you lose it you won’t be able to submit updates to your app!
  To sign the unsigned APK, run the jarsigner tool which is also included in the JDK:

$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore HelloWorld-release-unsigned.apk alias_name
   
   
  • 1

  This signs the apk in place. Finally, we need to run the zip align tool to optimize the APK. The zipalign tool can be found in /path/to/Android/sdk/build-tools/VERSION/zipalign. For example, on OS X with Android Studio installed, zipalign is in ~/Library/Android/sdk/build-tools/VERSION/zipalign:

$ zipalign -v 4 HelloWorld-release-unsigned.apk HelloWorld.apk
   
   
  • 1

  Now we have our final release binary called HelloWorld.apk.

           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

猜你喜欢

转载自blog.csdn.net/qq_43685640/article/details/84107795