Android原生工程配置导入uni-app项目-混合开发
16lz
2021-01-25
Android原生工程配置 官网配网地址:
https://nativesupport.dcloud.net.cn/AppDocs/usesdk/android
-
App离线SDK下载 我这边给大家放在资料里面了
-
新建Android项目Hello-H5
注意:Android项目目录不要有中文 -
拷贝android-gif-drawable-release@1.2.17.aar、lib.5plus.base-release.aar、miit_mdid_1.0.10.aar、uniapp-release.aar到libs下
-
在build.gradle中添加资源引用
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])implementation "com.android.support:support-v4:28.0.0"implementation "com.android.support:appcompat-v7:28.0.0"implementation 'com.android.support:recyclerview-v7:28.0.0'implementation 'com.facebook.fresco:fresco:1.13.0'implementation "com.facebook.fresco:animated-gif:1.13.0"implementation 'com.github.bumptech.glide:glide:4.9.0'implementation 'com.alibaba:fastjson:1.1.46.android'
5.uni-app配置时需要在build.gradle中添加aaptOptions配置
aaptOptions { additionalParameters '--auto-add-overlay' ignoreAssetsPattern "!.svn:!.git:.*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~" }
6. 在Androidmanifest.xml配置应用启动页
<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>
7) 添加图片资源
8) 新建assets文件夹,添加子文件夹data和apps
9) 拷贝资源到data目录下
10) 修改dcloud_control.xml的值,这里我填写了helloh5,大家可以随便填写
11) 在apps下面新建helloh5\www文件夹,注意helloh5就是刚刚你们填写的appid值。
12) 打包Vue项目,注意修改manifest.json中appid的值,这个值就是Android中dcloud_control.xml的appid的值
命令打包:npm run build:app-plus
- 把编译出来的项目拷贝到Android中
更多相关文章
- 没有一行代码,「2020 新冠肺炎记忆」这个项目却登上了 GitHub 中
- 不吹不黑!GitHub 上帮助人们学习编码的 12 个资源,错过血亏...
- 一款霸榜 GitHub 的开源 Linux 资源监视器!
- Android中使用Sonar进行代码质量分析
- Android(安卓)图片文件夹区别
- Android(安卓)SdCard 新建文件夹并在文件夹中读、写文件
- Android开发资源获取国内代理
- Android通过URL获取网络资源
- Eclipse集成Android(安卓)NDK开发环境