简体   繁体   English

Ionic CLI不会为Android生成发布版本

[英]Ionic CLI not generating release build for Android

When I use the command: cordova build --release android the CLI throws the following error: 当我使用命令: cordova build --release android ,CLI会抛出以下错误:

Error: Cannot find module 'minimatch'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (C:\Users\sologic\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\glob\glob.js:44:17)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)

But when I use Ionic Lab (Windows Installer) and using the Build option - it generates ' android-debug.apk ' & ' android-debug-unaligned.apk ' in the android\\build\\outputs\\apk folder. 但是当我使用Ionic Lab(Windows Installer)并使用Build选项时 - 它会在android\\build\\outputs\\apk文件夹中生成' android-debug.apk '和' android-debug-unaligned.apk android-debug.apk '。

Note that it is not generating android-release-unsigned.apk 请注意,它不会生成android-release-unsigned.apk

My questions are: 我的问题是:

1: What is wrong with the CLI ?? 1:CLI有什么问题?

2: can I use the android-debug-unaligned.apk for Signing (with jarsigner ) and Aligning (with zipalign ) for submitting on Google Play ?? 2:我可以使用android-debug-unaligned.apk进行签名(使用jarsigner )和zipalign (使用zipalign )在Google Play上提交?

Please advice. 请指教。

  1. Nothing went wrong with IONIC CLI at this time (v1.7.6), because I'm using it every day. IONIC CLI此时没有出错(v1.7.6),因为我每天都在使用它。

    • Check your CLI version by this command ionic --version and see if your version is lower than 1.7.6 . 通过此命令ionic --version检查您的CLI版本,看看您的版本是否低于1.7.6
    • If your CLI is old, run npm install -g ionic again to install the lasted version of Ionic CLI. 如果您的CLI已旧, npm install -g ionic再次运行npm install -g ionic以安装Ionic CLI的持续版本。
    • If not, try to re-create all new project, and try to build again with, if it OK, just because of your project: 如果没有,尝试重新创建所有新项目,并尝试再次构建,如果可以,只是因为您的项目:
      • ionic start appName blank
      • ionic platform add android
      • ionic build android --release
  2. You can't use the debug apk for Google Play because they can read your APK and check if is is debug or release version. 您不能将调试apk用于Google Play,因为他们可以阅读您的APK并检查是否是调试版或发布版。 But I think you can set the debug mode in your AndroidManifest.xml to false and try like this: 但我认为您可以将AndroidManifest.xmldebug mode设置为false并尝试这样:

  3. Ionic also provide a package cloud service very helpful for non-plugin project inside the Ionic CLI. Ionic还提供了一个云服务,非常有助于Ionic CLI中的非插件项目。 It can build all your project in the cloud in a minute and you can download the apk anytime. 它可以在一分钟内在云中构建您的所有项目,您可以随时下载apk。

    • cd to your ionic project folder by Ionic CLI. 通过Ionic CLI cd到您的离子项目文件夹。
    • Run ionic package build android an wait for the progress to done. 运行ionic package build android等待进度完成。
    • Run ionic package list to get the list and see the status if it has been done the building progress. 运行ionic package list以获取列表,并查看已完成构建进度的状态。
    • Run ionic package download [id] to download your apk to your project folder. 运行ionic package download [id]将你的apk下载到你的项目文件夹。 id is the number you see in the list . id是您在list看到的数字。
    • These commands will help you build the debug apk, for the release version, check this ionic.io package documents to build with profile (keystore). 这些命令将帮助您构建调试apk,对于发行版本,请检查此ionic.io包文档以使用profile (密钥库)进行构建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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