目录

用uniapp打包出一个跨端app!

目录

使用uniapp在macOS 10.15.6上打包安卓离线App

https://cdn.cjpa.top/cdnimages/image-20210116130501880.png

创建之后目录如下所示:

https://cdn.cjpa.top/cdnimages/image-20210116131343894.png

在hubilder离线sdk里面找到sdk/libs文件夹

https://cdn.cjpa.top/cdnimages/image-20210116131837447.png

将lib.5plus.base-release.aar、android-gif-drawable-release@1.2.17.aar、uniapp-release.aar和miit_mdid_1.0.10.aar(HBuilderX2.8.1之后更新到msa_mdid_1.0.13.aar)拷贝到libs目录下

https://cdn.cjpa.top/cdnimages/image-20210116131900943.png

在build.gradle里面添加资源引用

https://cdn.cjpa.top/cdnimages/image-20210116132010216.png

同时uniapp也需要添加这个:

https://cdn.cjpa.top/cdnimages/image-20210116132115458.png

https://cdn.cjpa.top/cdnimages/image-20210116132835736.png

删掉这个mainactivity节点

https://cdn.cjpa.top/cdnimages/image-20210116133000984.png

然后把这个给加进去

  <activity
      android:name="io.dcloud.PandoraEntry"
      android:configChanges="orientation|keyboardHidden|keyboard|navigation"
      android:label="@string/app_name"
      android:launchMode="singleTask"
      android:hardwareAccelerated="true"
      android:theme="@style/TranslucentTheme"
      android:screenOrientation="user"
      android:windowSoftInputMode="adjustResize" >
      <intent-filter>
          <action android:name="android.intent.action.MAIN" />
          <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
  </activity>
  <activity
      android:name="io.dcloud.PandoraEntryActivity"
      android:launchMode="singleTask"
      android:configChanges="orientation|keyboardHidden|screenSize|mcc|mnc|fontScale|keyboard"
      android:hardwareAccelerated="true"
      android:permission="com.miui.securitycenter.permission.AppPermissionsEditor"
      android:screenOrientation="user"
      android:theme="@style/DCloudTheme"
      android:windowSoftInputMode="adjustResize">
      <intent-filter>
          <category android:name="android.intent.category.DEFAULT" />
          <category android:name="android.intent.category.BROWSABLE" />
          <action android:name="android.intent.action.VIEW" />
          <data android:scheme="h56131bcf" />
      </intent-filter>
  </activity>
  <!--provider节点必须添加-->
  <provider
      android:name="io.dcloud.common.util.DCloud_FileProvider"
      android:authorities="${apk.applicationId}.dc.fileprovider"
      android:exported="false"
      android:grantUriPermissions="true">
      <meta-data
          android:name="android.support.FILE_PROVIDER_PATHS"
          android:resource="@xml/dcloud_file_provider" />
  </provider>

https://cdn.cjpa.top/cdnimages/image-20210116133236129.png

创建assets

https://cdn.cjpa.top/cdnimages/image-20210116133648742.png

把离线sdk的 assets/data 拷贝到assets中

![image-20210116133803676](/Users/cjp/Library/Application Support/typora-user-images/image-20210116133803676.png)

用hbuilder导出资源

复制到assets/apps里面

https://cdn.cjpa.top/cdnimages/image-20210116134502116.png

修改dcloud_control.xml文件

https://cdn.cjpa.top/cdnimages/image-20210116134628742.png

Caused by: org.gradle.internal.service.ServiceCreationException: Could not create service of type OutputFilesRepository using ExecutionGradleServices.createOutputFilesRepository().



Caused by: org.gradle.cache.LockTimeoutException: Timeout waiting to lock Build Output Cleanup Cache (/Volumes/PERSON/union_app/static-template-andorid/.gradle/buildOutputCleanup). It is currently in use by another Gradle instance.