uniapp离线打包


uniapp android 离线打包 步骤
1.HBUILDERX 生成  原生APP > 本地打包APP资源
生成的 unpackage\resources 目录下//nativesupport.dcloud.net.cn/AppDocs/importfeproject/export
2. 下载 //nativesupport.dcloud.net.cn/AppDocs/download/android
Android 离线SDK - 正式版
注意:HBuilderX 3.2.5版本之后适配 AndroidX 升级时需要参考文档重新配置
3. android studio 导入HBuilder-Integrate-AS 并删除原来的 资源
HBuilder-Integrate-AS\simpleDemo\src\main\assets\apps 里面的 内容合部删除
把HBUILDERX 生成的  原生APP > 本地打包APP资源 生成的 unpackage\resources 目录下的

4.正确配置 appid 比如这里是
修改 simpleDemo\src\main\assets\data\dcloud_control.xml
<hbuilder>
<apps>
<app appid="__UNI__83B3005" appver="1.1.0"/>
</apps>
</hbuilder>
5.自己定义签名文件
如果没有证书的话,点击Create new... 新建,如果已有证书, 点击Choose exiting... 选择已有证书
签名证书不要随意更换,否则会导致用户升级失败!
若之前云打包使用的是DCloud默认证书,为保证正常升级,依然可以继续下载DCloud证书使用证书地址  //ask.dcloud.net.cn/article/68
输入密码
key store password对应 第一个password
key password 对应 第二个password  点击Next
生成apk,Build Variants建议选release
正式发行尽量杜绝选择debug
Signature Versions建议都选,点击Finish


6.本地签名配置
 首先 需要在build.gradle中配置签名路径及密码
  android {
      signingConfigs {
          config {
              storeFile file('myapp.jks') // 支持相对路径与绝对路径 myapp.jks 是上一步生成的
              storePassword '123456'       // 上一步输入的密码
              keyAlias = '别名' // 上一步输入的别名 建议使用公司英文简称
              keyPassword '123456'  // 上一步输入的密码
          }
      }
      buildTypes {
          debug {
              signingConfig signingConfigs.config
          }
          release {
              signingConfig signingConfigs.config
          }
      }
  }


7.开发者后台获取 //dev.dcloud.net.cn/app/   配置Appkey
3.1.10版本起需要申请 Appkey,申请请参考 //nativesupport.dcloud.net.cn/AppDocs/usesdk/appkey
打开Androidmanifest.xml, 导航到Application节点,创建meta-data节点,name为dcloud_appkey,value为申请的AppKey如下
<application  ...>
  <meta-data
      android:name="dcloud_appkey"
      android:value="替换为自己申请的Appkey" />

配置信息 Android:xxxxyyyyyyzzid
并输入到src\main\AndroidManifest.xml 中的
android:name="dcloud_appkey"
android:value="xxxxyyyyyyzzid" />
8.配置应用名称

打开app-> src -> main -> res -> values -> strings.xml文件,修改“app_name”字段值,该值为安装到手机上桌面显示的应用名称,建议与manifest.json中name(基础配置中的应用名称)对应
8.生成安装包
注意:如果需要生成aab安装包,需要在项目根目录下的gradle.properties文件中添加如下内容
android.bundle.enableUncompressedNativeLibs = false
点击Build->Generate Signed Bundle/APK.


Disable Gradle 'offline mode' and sync project
Android Studio 4.1.2 新建工程报错
报错内容
环境
解决问题
ERROR: Could not GET ‘https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.1/gradle-3.5.1.pom’. Received status code 400 from server: Bad Request Enable Gradle ‘offline mode’ and sync project
环境
Android Studio 4.1.2
Build #AI-191.8026.42.35.5900203, built on September 26, 2019
JRE: 1.8.0_202-release-1483-b03 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 7

解决问题
3.0及以上默认使用 Google 的 Maven 存储库
解决办法就是不设置代理勾选NO Proxy
删掉.gradle目录下的gradle.properties文件重新build一下。
不添加代理(就是这个目录C:\Users\Administrator\.gradle 下的 gradle.properties 也可以选择注释掉里面的内容)
等了一段时间下载依赖,项目就重建好了

AndroidStudio 中如何查看获取MD5和SHA1值(应用签名)
一个简单高效的方法
Android Studio工具
在右侧找到菜单栏
Gradle
APP名
Tasks
android
双击
signReport
即可
在Terminal中可以查看debug版本
resalse版本的SHA1和MD5值


UNI-APP获取manifest.json数据
plus.runtime.getProperty(plus.runtime.appid, (info)=> {
   let version = info.version;
    console.log("launchLoadedTime: " + plus.runtime.launchLoadedTime);
    console.log("launcher: " + plus.runtime.launcher);
    console.log("appId: " + info.appid);
    console.log("version: " + info.version);
    console.log("code: " + info.version.code);
    console.log("innerVersion:" + plus.runtime.innerVersion);
    console.log("name: " + info.name);
    console.log("description: " + info.description);
    console.log("author: " + info.author);
    console.log("license: " + info.license);
    console.log("licensehref: " + info.licensehref);
    console.log("features: " + info.features);
});


windows如何远程桌面mac
mac远程windows系统比较容易 但是windows远程mac就相对复杂一点 需要借助第三方工具来实现
下面给出简要的远程步骤
1 登录mac,点击苹果图标,然后单击【系统偏好设置...]
2 在【系统偏好设置】界面中,单击【共享】
3  在【共享】中勾选【屏幕共享】,然后单击【电脑设置...】
4.勾选VNC 然后输入密码
至此 mac机配置完成

windows操作系统上进行配置
1 下载TightVNC //www.tightvnc.com/download.php
2 安装后,打开TightVNC Viewer
3 输入远程mac地址,单击【connect]
4 输入mac机中设置的VNC密码,单击【OK】
5 如果成功 会显示 界面


Android 教程和uniapp相关