致命异常:java.lang.NoSuchMethodError没有直接方法 Lcom / google / android / gms / maps / model / LatLng类中的(DD)V;或其 超类(声明 “ com.google.android.gms.maps.model.LatLng”出现在base.apk中)
我仅在三星设备SM-G610F(牛轧糖)上遇到这种奇怪的崩溃,它在其他设备上也可以正常工作。
等级依赖性:
implementation "com.google.firebase:firebase-messaging:11.0.2"
implementation "com.google.android.gms:play-services-gcm:11.0.2"
implementation "com.google.android.gms:play-services-location:11.0.2"
implementation "com.google.android.gms:play-services-maps:11.0.2"
implementation "com.google.android.gms:play-services-places:11.0.2"
编辑:
我在项目中有多个模块,基本模块现在包含大多数依赖项,并且已启用 mutlidexing 。
基本模块的build.gradle文件:
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion compile_sdk_version
buildToolsVersion build_tools_version
defaultConfig {
minSdkVersion min_sdk_version
targetSdkVersion target_sdk_version
versionCode version_code
versionName version_name
vectorDrawables.useSupportLibrary true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled true
}
}
dependencies {
// Kotlin: Std Lib
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Android Support
implementation "com.android.support:appcompat-v7:$android_support"
implementation "com.android.support:cardview-v7:$android_support"
implementation 'com.android.support.constraint:constraint-layout:1.1.0-beta5'
implementation "com.android.support:design:$android_support"
implementation "com.android.support:recyclerview-v7:$android_support"
implementation "com.android.support:support-v4:$android_support"
// Android Arch: LiveData
implementation "android.arch.lifecycle:livedata:$android_arch"
// Google Play Services
implementation "com.google.firebase:firebase-messaging:$google_play_services"
implementation "com.google.android.gms:play-services-gcm:$google_play_services"
implementation "com.google.android.gms:play-services-location:$google_play_services"
implementation "com.google.android.gms:play-services-maps:$google_play_services"
implementation "com.google.android.gms:play-services-places:$google_play_services"
implementation 'io.branch.sdk.android:library:1.14.5'
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'com.github.bumptech.glide:glide:4.7.1'
implementation project(':ui')
}
应用模块的build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion compile_sdk_version
buildToolsVersion build_tools_version
defaultConfig {
minSdkVersion min_sdk_version
targetSdkVersion target_sdk_version
versionCode version_code
versionName version_name
multiDexEnabled true
vectorDrawables.useSupportLibrary true
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
productFlavors {
stage {
dimension "mode"
applicationId "com.example.abc.stage"
}
production {
applicationId "com.example.abc"
}
}
dataBinding {
enabled true
}
}
repositories {
mavenCentral()
}
dependencies {
// Modules
implementation project(':base')
// MultiDex: 65k+ methods
implementation 'com.android.support:multidex:1.0.3'
implementation "com.android.support:appcompat-v7:$android_support"
implementation "com.android.support:support-v4:$android_support"
implementation "android.arch.lifecycle:livedata:$android_arch"
}
apply plugin: 'com.google.gms.google-services'