1.Hbuilderx生成本地打包App资源

生成资源包如图:
2.在打包指南链接中下载Sdk包
https://nativesupport.dcloud.net.cn/AppDocs/download/android
下载完后解压,得到以下文件
3.Android Studio创建空工程

在新工程目录 src/main/assets 中创建apps目录,
1.将hbuilderx生成的资源包文件放到src/main/assets/apps/目录下
2.将打包指南中下载的sdk包中的 Android-SDK@3.4.7.81308_20220424/SDK/assets/data 文件放入 src/main/assets 目录


3.修改 dcloud_control.html 中的 appid 为 hbuilderx 生成的资源包文件名 __UNI__B356F03 

4.将 Android-SDK@3.4.7.81308_20220424/SDK/libs 中的 lib.5plus.base-release.aar 拷贝到新工程的 app/libs 目录下
5.在 androidmanifest.xml 中添加 activity
<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>io.dcloud.PandoraEntry和io.dcloud.PandoraEntryActivity报错- 在app/build.gradle中添加maven依赖包
 
    implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
    implementation 'com.alibaba:fastjson:1.1.46.android'Installed Build Tools revision 32.0.0 is corrupted.的解决方法

出现这个问题的原因是sdk缺少了两个文件: dx.bat , dx.jar 
这两个文件在sdk中都有,只是名字错了,需要复制一份重命名:
具体解决方案:
找到并进入 C: <本地Android Sdk实际路径> AndroidSdkbuild-tools32.0.0 目录
 提示 :AppData是一个隐藏文件夹,打开隐藏项就可以看到AppData文件夹
找到 d8.bat 的文件(Windows批处理文件),复制并粘贴在 当前文件夹 ,重新命名为 dx.bat 
进入 C: <本地Android Sdk实际路径> AndroidSdkbuild-tools32.0.0lib 目录
复制 d8.jar 并粘贴在当前文件夹,重新命名为 dx.jar .
然后重新编译项目
                
            
        
评论 (0)