android studio怎样运行uniapp打包项目_uni app系列002:离线打包apk(2)
一、用AS新建空項目
新建項目后刪除如圖說明的文件
二、AndroidManifest.xml 替換如下的application內容
三、導入uni app本地資源文件
assets, apps需要自己創建目錄
四、下載最新SDK
在 Dcloud里下載最新的SDK
下載解壓后目錄如下
HBuilder-Hello:是HelloH5打包App的示例,可以用AS打包成APKHBuilder-Integrate-AS:是HBuilder 5+ SDK 集成AS的示例SDK:是HBuilder SDK庫文件UniPlugin-Hello-AS:是開發插件并集成到Vue的示例五、復制HBuilder-Hello項目的data到自己項目對應目錄中
六、復制HBuilder-Hello項目的libs下的三個文件到自己項目對應目錄中
六、修改配置文件
1)dcloud_control.xml
七、開始打包
1)錯誤1
AndroidManifest.xml:13:9-26:20: AAPT: error: resource style/TranslucentTheme (aka com.ntc.test.uniapp:style/TranslucentTheme) not found.
這個錯誤,需要在build.gradle(Moudle app)中增加implementation fileTree(include: ['*.aar'], dir: 'libs'),以便在打包時將libs目錄下的aar文件打包入apk
2)錯誤2
Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version 17 declared in library [android-gif-drawable-release@1.2.17.aar] C:甥敳獲Administrator.gradlecachesransforms-2files-2.1092de47bbd5688ebca77a3b9b43742bbandroid-gif-drawable-release@1.2.17AndroidManifest.xml as the library might be using APIs not available in 15
Suggestion: use a compatible library with a minSdk of at most 15,
or increase this project's minSdk version to at least 17,
or use tools:overrideLibrary="pl.droidsonroids.gif" to force usage (may lead to runtime failures)
這個錯誤,需要在build.gradle(Moudle app)中minSdkVersion改為 19
3)白屏
需要將build.gradle(Moudle app)中dependencies 換為如下
dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.aar'], dir: 'libs') /*uniapp所需庫-----------------------開始*/ implementation 'com.android.support:recyclerview-v7:26.1.0' implementation 'com.alibaba.android:bindingx-core:1.0.3' implementation 'com.alibaba.android:bindingx_weex_plugin:1.0.3' implementation 'com.squareup.okhttp:okhttp:2.3.0' implementation 'com.squareup.okhttp:okhttp-ws:2.3.0' implementation 'com.alibaba:fastjson:1.1.46.android' implementation 'com.facebook.fresco:fresco:1.13.0' implementation "com.facebook.fresco:animated-gif:1.13.0" /*uniapp所需庫-----------------------結束*/}4)打出的包有20多M
需要在build.gradle(Moudle app)中defaultConfig下增加
ndk { abiFilters 'x86','armeabi-v7a'}增加后打出的包有16多M
八、完整的build.gradle(Moudle app)
apply plugin: 'com.android.application'android { compileSdkVersion 29 defaultConfig { applicationId "com.ntc.test.myapplication" minSdkVersion 19 targetSdkVersion 29 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" ndk { abiFilters 'x86','armeabi-v7a' } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } }}dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.aar'], dir: 'libs') /*uniapp所需庫-----------------------開始*/ implementation 'com.android.support:recyclerview-v7:26.1.0' implementation 'com.alibaba.android:bindingx-core:1.0.3' implementation 'com.alibaba.android:bindingx_weex_plugin:1.0.3' implementation 'com.squareup.okhttp:okhttp:2.3.0' implementation 'com.squareup.okhttp:okhttp-ws:2.3.0' implementation 'com.alibaba:fastjson:1.1.46.android' implementation 'com.facebook.fresco:fresco:1.13.0' implementation "com.facebook.fresco:animated-gif:1.13.0" /*uniapp所需庫-----------------------結束*/}總結
以上是生活随笔為你收集整理的android studio怎样运行uniapp打包项目_uni app系列002:离线打包apk(2)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: wifi一阵一阵卡_家里wifi总是过一
- 下一篇: mysql启动选项只读_MySQL的启动