|
@@ -6,14 +6,51 @@
|
|
|
## 一、打包web资源到www文件内
|
|
|
- ionic build --project=live-app//默认打包 或者 ng build live-app --output-path=www/live-app
|
|
|
## 二、添加 Android 平台
|
|
|
- - npx cap sync android 添加 Android 平台(如果尚未添加)
|
|
|
+ - npx cap add android 添加 Android 平台
|
|
|
+ - npx cap sync android 同步你的项目配置到Android平台(如果尚未添加)
|
|
|
- 打开 Android 项目(可选): npx cap open android
|
|
|
- android\gradle\wrapper\gradle-wrapper.properties 中 gradle-wrapper.properties 中修改阿里镜像文件
|
|
|
distributionUrl=https://mirrors.aliyun.com/macports/distfiles/gradle/gradle-8.2.1-all.zip
|
|
|
+ - 修改build.gradle文件
|
|
|
+ ``` bash
|
|
|
+ android {
|
|
|
+ ***
|
|
|
+ signingConfigs {
|
|
|
+ //签名信息
|
|
|
+ release {
|
|
|
+ keyAlias System.getenv('KEY_ALIAS') ?: 'heychat'
|
|
|
+ keyPassword System.getenv('KEY_PASSWORD') ?: '12345678'
|
|
|
+ storeFile file(System.getenv('KEYSTORE_PATH') ?: '../heychat.keystore')
|
|
|
+ storePassword System.getenv('STORE_PASSWORD') ?: '12345678'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ android.applicationVariants.all(variant ->{
|
|
|
+ variant.outputs.all{
|
|
|
+ outputFileName = "heychat.apk"
|
|
|
+ }
|
|
|
+ })
|
|
|
+ buildTypes {
|
|
|
+ release {
|
|
|
+ ***
|
|
|
+ signingConfig signingConfigs.release
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ```
|
|
|
+ - gradle.properties文件新增(可选)
|
|
|
+ ``` bash
|
|
|
+ # android/gradle.properties
|
|
|
+ org.gradle.caching=true
|
|
|
+ org.gradle.parallel=true
|
|
|
+ org.gradle.daemon=true
|
|
|
+ org.gradle.configureondemand=true
|
|
|
+ ```
|
|
|
+
|
|
|
## 三、打包 Android 平台
|
|
|
- npx cap build android 构建 Android 应用
|
|
|
|
|
|
-
|
|
|
+ ## 四、打开 Android Studio(可选)
|
|
|
+ - npx cap open android 这将自动启动 Android Studio 并打开 android 文件夹中的项目
|
|
|
# cordova打包(弃用)
|
|
|
- ionic cordova build android --release
|
|
|
|