Blogger Information
Blog 2
fans 0
comment 0
visits 1245
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
uni-app离线打包APK教程
P粉469731340
Original
720 people have browsed it

一、 资源准备

  1. 下载SDK

​ 网址:https://nativesupport.dcloud.net.cn/AppDocs/download/android

  1. 下载Android Studio

    网址:https://nativesupport.dcloud.net.cn/UniMPDocs/SDKDownload/android

  2. Appkey申请

二、打包本地资源

打包uni-app项目本地资源,发行——原生App-本地打包——生成本地打包App资源,在项目目录下会生成“unpackage”目录见下图

三、导入SDK项目

  1. 解压下载好对应版本的SDK,里面有一个原生App项目,见下图

  2. 将SDK中HBuilder-Integrate-AS\simpleDemo\src\main\assets\apps__UNI__A的该文件夹用uni-app打包好unpackage——resources—— -UNI-*文件夹替换掉

  3. 使用Android Studio打开HBuilder-Integrate-AS项目

四、修改AS项目配置文件

  1. 修改app下的build.gradle文件

    1. signingConfigs {
    2. config {
    3. keyAlias 'citysmart'
    4. keyPassword '111111'
    5. storeFile file('citysmart.keystore')
    6. storePassword '111111'
    7. v1SigningEnabled true
    8. v2SigningEnabled true
    9. }
    10. }
    11. //keyAlias:生成证书时的别名;storeFile file:证书名全程,建议放在app项目下
    12. applicationId "com.zhlj.citysmart"
    13. //applicationId:个人中心填写的包名
  2. 修改AndroidManifest.xml文件

    1. <meta-data
    2. android:name="dcloud_appkey"
    3. android:value="8285e65623ea464774523522d957e6bb" />
    4. //value:个人中心生成的Appkey值
    5. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    6. package="com.zhlj.citysmart">
    7. //package:包名为个人中心填写的包名称
  3. 修改control.xml文件

    1. //main\assets\data\dcloud_control.xml文件中
    2. <hbuilder>
    3. <apps>
    4. <app appid="__UNI__6FE3F0B" appver=""/>
    5. </apps>
    6. </hbuilder>
    7. //appid:HBuilder中的appid
  4. App名称和图标自己设定

五、AS打包

1.在Android Studio中菜单栏点击Build——Generate Signed Bundle/APK,见下图,打开后选择APK,next

  1. 填入生成的.keystore证书,密码及别名,Next,见下图

  2. 选择debug或者release版本,finish即可打包完成,见下图

  3. release安装包存放路径

  • 打包好的APK存放在APP下的release文件夹内,见下图
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post