uni-app 原生插件制作,android端
uni-app 原生插件制作,android端
开发环境 | 版本号 | 项目创建方式 |
---|---|---|
Mac | Mac 13.6.1 (22G313) | HBuilderX |
示例代码:
"dependencies": [
"com.google.android.material:material:1.8.0",
"androidx.constraintlayout:constraintlayout:2.1.4",
"androidx.recyclerview:recyclerview:1.2.1",
"androidx.legacy:legacy-support-v4:1.0.0",
"androidx.appcompat:appcompat:1.0.0",
"com.alibaba:fastjson:1.2.83",
"com.facebook.fresco:fresco:1.13.0",
"com.google.android.gms:play-services-location:18.0.0"
]
{
"id": "com.google.android.libraries.navigation:navigation",
"source": "implementation ('com.google.android.libraries.navigation:navigation:6.0.0',{\r\nexclude group: 'com.google.android.gms'\r\n})"
},
{
"id":"com.google.android.libraries.places:places",
"source":"implementation ('com.google.android.libraries.places:places:3.3.0',{\r\nexclude group: 'com.google.android.gms'\r\n})"
}
dependencies {
implementation project(path: ':uniplugin_component')
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
compileOnly fileTree(dir: 'libs', include: ['*.jar'])
//uniapp配置
compileOnly fileTree(dir: '../app/libs', include: ['uniapp-v8-release.aar'])
compileOnly 'androidx.recyclerview:recyclerview:1.2.1'
compileOnly 'androidx.legacy:legacy-support-v4:1.0.0'
compileOnly 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.alibaba:fastjson:1.2.83'
implementation 'com.facebook.fresco:fresco:1.13.0'
///ditu
implementation ('com.google.android.libraries.navigation:navigation:6.0.0',{
exclude group: 'com.google.android.gms', module: 'play-services-maps'
})
implementation ('com.google.android.libraries.places:places:3.3.0',{
exclude group: 'com.google.android.gms'
})
implementation 'com.google.android.gms:play-services-location:18.0.0'
插件依赖的库com.google.android.libraries.navigation:navigation:6.0.0和com.google.android.gms:play-services-maps:18.0.2冲突导致,关键错误信息如下:
Duplicate class com.google.android.gms.maps.CameraUpdate found in modules jetified-navigation-6.0.0-runtime (com.google.android.libraries.navigation:navigation:6.0.0) and jetified-play-services-maps-18.0.2-runtime (com.google.android.gms:play-services-maps:18.0.2)
Duplicate class com.google.android.gms.maps.CameraUpdateFactory found in modules jetified-navigation-6.0.0-runtime (com.google.android.libraries.navigation:navigation:6.0.0) and jetified-play-services-maps-18.0.2-runtime (com.google.android.gms:play-services-maps:18.0.2)