ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

uniapp离线打包

2022-02-18 13:33:37  阅读:375  来源: 互联网

标签:uniapp 1.0 implementation 离线 aar android com 打包


uniapp离线打包,记录下爬坑

官方网址:https://nativesupport.dcloud.net.cn/AppDocs/usesdk/android

1,首先从官网下载离线sdk

     准备工程有2种方式,一种新建空白项目,另一种引入工程,建议新手第二种方便一些

2,将离线sdk包中的lib.5plus.base-release.aar、android-gif-drawable-release@1.2.23.aar、uniapp-v8-release.aar和oaid_sdk_1.0.25.aar拷贝到项目libs目录下

3,配置Androidmanifest.xml文件,代码如下:

      红色背景色为要修改的内容

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 3     package="hz.lin.jinyun">
 4 
 5     <application
 6         android:allowBackup="true"
 7         android:allowClearUserData="true"
 8         android:icon="@drawable/icon"
 9         android:label="@string/app_name"
10         android:largeHeap="true"
11         android:supportsRtl="true">
12         <activity
13             android:name="io.dcloud.PandoraEntry"
14             android:configChanges="orientation|keyboardHidden|keyboard|navigation"
15             android:label="@string/app_name"
16             android:launchMode="singleTask"
17             android:hardwareAccelerated="true"
18             android:theme="@style/TranslucentTheme"
19             android:screenOrientation="user"
20             android:windowSoftInputMode="adjustResize" >
21             <intent-filter>
22                 <action android:name="android.intent.action.MAIN" />
23                 <category android:name="android.intent.category.LAUNCHER" />
24             </intent-filter>
25         </activity>
26         <activity
27             android:name="io.dcloud.PandoraEntryActivity"
28             android:launchMode="singleTask"
29             android:configChanges="orientation|keyboardHidden|screenSize|mcc|mnc|fontScale|keyboard|smallestScreenSize|screenLayout|screenSize"
30             android:hardwareAccelerated="true"
31             android:permission="com.miui.securitycenter.permission.AppPermissionsEditor"
32             android:screenOrientation="user"
33             android:theme="@style/DCloudTheme"
34             android:windowSoftInputMode="adjustResize">
35             <intent-filter>
36                 <category android:name="android.intent.category.DEFAULT" />
37                 <category android:name="android.intent.category.BROWSABLE" />
38                 <action android:name="android.intent.action.VIEW" />
39                 <data android:scheme="h56131bcf" />
40             </intent-filter>
41         </activity>
42         <meta-data
43             android:name="dcloud_appkey"
44             android:value="165a366b4082ac1620460d8660c73bb1" />
45         <provider
46             android:name="io.dcloud.common.util.DCloud_FileProvider"
47             android:authorities="hz.lin.jinyun.dc.fileprovider"
48             android:exported="false"
49             android:grantUriPermissions="true">
50             <meta-data
51                 android:name="android.support.FILE_PROVIDER_PATHS"
52                 android:resource="@xml/dcloud_file_provider" />
53         </provider>
54     </application>
55 
56 </manifest>

4,配置build.gradle

 1 apply plugin: 'com.android.application'
 2 
 3 android {
 4     compileSdkVersion 29
 5     defaultConfig {
 6         applicationId "hz.lin.jinyun"
 7         minSdkVersion 21
 8         targetSdkVersion 28
 9         versionCode 14
10         versionName "1.0.14"
11         multiDexEnabled true
12         ndk {
13             abiFilters 'x86', 'armeabi-v7a', 'arm64-v8a'
14         }
15     }
16     compileOptions {
17         sourceCompatibility JavaVersion.VERSION_1_8
18         targetCompatibility JavaVersion.VERSION_1_8
19     }
20     signingConfigs {
21         config {
22             keyAlias 'testalias888'
23             keyPassword '888888'
24             storeFile file('test888.keystore')
25             storePassword '888888'
26             v1SigningEnabled true
27             v2SigningEnabled true
28         }
29     }
30 
31     buildTypes {
32         debug {
33             signingConfig signingConfigs.config
34             minifyEnabled false
35             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
36         }
37         release {
38             signingConfig signingConfigs.config
39             minifyEnabled false
40             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
41         }
42     }
43     androidResources {
44         ignoreAssetsPattern '!.svn:!.git:.*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~'
45         additionalParameters '--auto-add-overlay'
46     }
47     lint {
48         baseline = file("lint-baseline.xml")
49     }
50 }
51 
52 dependencies {
53     implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
54     implementation 'androidx.appcompat:appcompat:1.0.0'
55     implementation 'androidx.legacy:legacy-support-v4:1.0.0'
56     implementation 'androidx.recyclerview:recyclerview:1.0.0'
57     implementation 'com.facebook.fresco:fresco:2.5.0'
58     implementation "com.facebook.fresco:animated-gif:2.5.0"
59     implementation 'com.github.bumptech.glide:glide:4.9.0'
60     implementation 'com.alibaba:fastjson:1.1.46.android'
61 }

5,配置strings.xml

1 <resources>
2     <string name="app_name">测试app</string>
3 </resources>

6,uniapp生成本地资源

7,复制uniapp生成的本地资源到\simpleDemo\src\main\assets\apps\目录

8,复制test888.keystore到项目的根目录(test888.keystore生成参见https://ask.dcloud.net.cn/article/35777

3.1.10版本起需要申请Appkey,具体请点击链接

9,生成app

 

标签:uniapp,1.0,implementation,离线,aar,android,com,打包
来源: https://www.cnblogs.com/sharestone/p/15908247.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有