Mui项目在AndroidStudio中离线打包
1下载新版5+SDK
http://download.dcloud.net.cn/[email protected]_20190315.zip
2将HBuilder中的mui项目进行打包,生成带AppID名的文件夹(unpackage/resources/appid的文件夹)
3打开AndroidStudio,在main目录下创建assets资源package,并在其目录下创建apps,并将带appid的整个文件夹复制到apps中,将Android-SDK/HBuilder-Integrate-AS/app/src/main/assets/data文件夹复制到AndroidStudio的assets目录下。
4修改dcloud_control.xml(appid为App的ID)
<hbuilder version="1.9.9.59671">
<apps>
<app appid="appid" appver=""/>
</apps>
</hbuilder>
5将Android-SDK/HBuilder-Integrate-AS/app/libs/lib.5plus.base-release.aar复制到AndroidStudio的libs下
6修改AndroidManifest.xml
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true"/>
<application
android:name="io.dcloud.application.DCloudApplication"
android:allowBackup="true"
android:allowClearUserData="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true">
<!--===========================================广告联盟配置相关 开始===================================-->
<activity
android:name="io.dcloud.PandoraEntry"
android:configChanges="orientation|keyboardHidden|screenSize|mcc|mnc|fontScale"
android:hardwareAccelerated="true"
android:screenOrientation="user"
android:theme="@style/TranslucentTheme"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action
android:name="android.intent.action.MAIN"/>
<category
android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!--开发者须自行配置该字段对应value值,替换appid和adid为自己应用的appid和广告联盟会员id,否则可能影响统计结算-->
<!--<meta-data-->
<!--android:name="DCLOUD_STREAMAPP_CHANNEL"-->
<!--android:value="io.dcloud.HelloH5|HelloH5|adid" />-->
<!--===========================================广告联盟配置相关 结束===================================-->
</application>
7修改build.gradle,将lib.5plus.base-release.aar引入
dependencies {
implementation fileTree(include: ['*.jar','*.aar'], dir: 'libs')
}
8运行app查看是否离线打包成功