安卓启动报错未添加 sqllite 模块
安卓启动报错未添加 sqllite 模块
程序员朱永胜有的时候博客内容会有变动,首发博客是最新的,其他博客地址可能会未同步, 认准
https://blog.zysicyj.top
可点击链接
https://blog-1253652709.cos.ap-guangzhou.myqcloud.com//picgo/202401180921373.png
解答疑问
BUG 背景
问题现场
产生原因
解决方法
官方 SDK 下载地址:https://nativesupport.dcloud.net.cn/AppDocs/download/android
uniapp 导入 sqlite 模块:
第一步,使用 HBuilderX:
打开 manifest.json 配置文件:
第二步,如果使用离线打包,此时无需其他配置,可直接打包使用,如使用离线打包:
使用 Android studio:
在官方提供的 SDK 解压后,在 libs 目录下找到 sqlite-release.aar,并将其复制到 app/libs 下:
然后在 build.gradle 中添加以下代码,如已添加,请继续下一步:
1 | implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: []) |
附上完整的:
1 | id 'com.android.application' buildToolsVersion '28.0.3' applicationId "com.example.myapplication" abiFilters 'x86','armeabi-v7a' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 additionalParameters '--auto-add-overlay' ignoreAssetsPattern "!.svn:!.git:.*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~" implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'com.google.android.material:material:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 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' |
打开 app/src/main/assets/data/dcloud_properties.xml添加以下配置项:
1 | <feature name="Sqlite" value="io.dcloud.feature.sqlite.DataBaseFeature" /> |
附上完整的:
1 | <feature name="Barcode" value="io.dcloud.feature.barcode2.BarcodeFeatureImpl"/><feature name="Speech" value="io.dcloud.feature.speech.SpeechFeatureImpl"><module name="iFly" value="io.dcloud.feature.speech.IflySpeechEngine"/><module name="baidu" value="io.dcloud.feature.speech.BaiduSpeechEngine"/><feature name="Maps" value="io.dcloud.js.map.amap.JsMapPluginImpl"/><feature name="Contacts" value="io.dcloud.feature.contacts.ContactsFeatureImpl"/><feature name="Messaging" value="io.dcloud.adapter.messaging.MessagingPluginImpl"/><feature name="Camera" value="io.dcloud.js.camera.CameraFeatureImpl"/><feature name="Console" value="io.dcloud.feature.pdr.LoggerFeatureImpl"/><feature name="Device" value="io.dcloud.feature.device.DeviceFeatureImpl"/><feature name="File" value="io.dcloud.js.file.FileFeatureImpl"/><feature name="Proximity" value="io.dcloud.feature.sensor.ProximityFeatureImpl"/><feature name="Storage" value="io.dcloud.feature.pdr.NStorageFeatureImpl"/><feature name="Cache" value="io.dcloud.feature.pdr.CoreCacheFeatureImpl"/><feature name="Invocation" value="io.dcloud.invocation.Invocation"/><feature name="Navigator" value="io.dcloud.feature.ui.navigator.NavigatorUIFeatureImpl"/><feature name="NativeUI" value="io.dcloud.feature.ui.nativeui.NativeUIFeatureImpl"/><feature name="UI" value="io.dcloud.feature.ui.UIFeatureImpl"><module name="Navigator" value="io.dcloud.feature.ui.NavView"/><feature name="Gallery" value="io.dcloud.js.gallery.GalleryFeatureImpl"/><feature name="Downloader" value="io.dcloud.net.DownloaderFeatureImpl"/><feature name="Uploader" value="io.dcloud.net.UploadFeature"/><feature name="Push" value="io.dcloud.feature.aps.APSFeatureImpl"><module name="igexin" value="io.dcloud.feature.apsGt.GTPushService"/><feature name="Zip" value="io.dcloud.feature.pdr.ZipFeature"/><feature name="Audio" value="io.dcloud.feature.audio.AudioFeatureImpl"/><feature name="Runtime" value="io.dcloud.feature.pdr.RuntimeFeatureImpl"/><feature name="VideoPlayer" value="io.dcloud.media.MediaFeatureImpl"/><feature name="LivePusher" value="io.dcloud.media.live.LiveMediaFeatureImpl"/><feature name="XMLHttpRequest" value="io.dcloud.net.XMLHttpRequestFeature"/><feature name="Statistic" value="io.dcloud.feature.statistics.StatisticsFeatureImpl"/><feature name="Accelerometer" value="io.dcloud.feature.sensor.AccelerometerFeatureImpl"/><feature name="Orientation" value="io.dcloud.feature.sensor.OrientationFeatureImpl"/><feature name="NativeObj" value="io.dcloud.feature.nativeObj.FeatureImpl"/> <feature name="Geolocation" value="io.dcloud.js.geolocation.GeolocationFeatureImpl"/><feature name="Payment" value="io.dcloud.feature.payment.PaymentFeatureImpl"><module name="AliPay" value="io.dcloud.feature.payment.alipay.AliPay"/><module name="Payment-Weixin" value="io.dcloud.feature.payment.weixin.WeiXinPay"/><module name="Payment-Qihoo" value="io.dcloud.feature.payment.qihoopay.QihooPay"/><feature name="Share" value="io.dcloud.share.ShareFeatureImpl"><module name="Sina" value="io.dcloud.share.sina.SinaWeiboApiManager"/><module name="Tencent" value="io.dcloud.share.tencent.TencentWeiboApiManager"/><module name="Weixin" value="io.dcloud.share.mm.WeiXinApiManager"/><module name="QQ" value="io.dcloud.share.qq.QQApiManager"/><feature name="OAuth" value="io.dcloud.feature.oauth.OAuthFeatureImpl"><module name="OAuth-Weixin" value="io.dcloud.feature.oauth.weixin.WeiXinOAuthService"/><module name="OAuth-QQ" value="io.dcloud.feature.oauth.qq.QQOAuthService"/><module name="OAuth-Sina" value="io.dcloud.feature.oauth.sina.SinaOAuthService"/><module name="OAuth-Qihoo" value="io.dcloud.oauth.qihoo.QihooOAuthService"/><module name="OAuth-MiUi" value="io.dcloud.feature.oauth.miui.MiUiOAuthService"/><feature name="Stream" value="io.dcloud.appstream.js.StreamAppFeatureImpl"/><feature name="Fingerprint" value="io.dcloud.feature.fingerprint.FingerPrintsImpl"/><feature name="iBeacon" value="io.dcloud.feature.iBeacon.WxBluetoothFeatureImpl"/><feature name="Bluetooth" value="io.dcloud.feature.bluetooth.BluetoothFeature"/><feature name="Sqlite" value="io.dcloud.feature.sqlite.DataBaseFeature"/><feature name="Ad" value="io.dcloud.feature.ad.AdFlowFeatureImpl"><module name="360" value="io.dcloud.feature.ad.juhe360.AD360Module"/><module name="csj" value="io.dcloud.feature.ad.csj.ADCsjModule"/><module name="gdt" value="io.dcloud.feature.ad.gdt.ADGdtModule"/><service name="push" value="io.dcloud.feature.aps.APSFeatureImpl"/><service name="Statistic" value="io.dcloud.feature.statistics.StatisticsBootImpl"/><service name="Downloader" value="io.dcloud.net.DownloaderBootImpl"/> |