Status Update
Comments
wi...@gmail.com <wi...@gmail.com> #2
i am using these dependencies for the map
// Maps SDK for Android KTX Library implementation 'com.google.maps.android:maps-ktx:3.0.0'
// Maps SDK for Android Utility Library KTX Library
implementation 'com.google.maps.android:maps-utils-ktx:3.0.0'
implementation 'com.google.android.gms:play-services-base:18.5.0' implementation 'com.google.android.gms:play-services-basement:18.5.0' implementation 'com.google.android.gms:play-services-maps:19.0.0'
and also getting some map sdk error as well dab File created: google_maps_sdk_crash dab File created: _google_maps_sdk_crash_count_1 dab Couldn't create marker: google_maps_sdk_crash dab File created: _google_maps_sdk_crash_count_2 dab Marker deleted: _google_maps_sdk_crash_count_1
ca...@google.com <ca...@google.com> #3
Thank you for posting.
We are currently looking into this and will get back to you as soon as we have an update.
wi...@gmail.com <wi...@gmail.com> #4
Thank you for waiting.
We'll need some more details to troubleshoot this issue - please provide the following, in particular steps to reproduce the issue:
-
Put together a simplified reproduction case (
http://sscce.org/ ) and add it to a git hosting provider (e.g. github, bitbucket, etc)? The easiest way to do this might be to fork the Google Maps Android API Samples Repository and modify one of the existing demo activities:https://github.com/googlemaps/android-samples -
List steps to reproduce the problem
- Maps SDK client library version (used to build your app):
- Maps renderer (Latest or Legacy):
- Devices you have verified this issue on:
- Google Play Services version on the device:
- Android version:
- Manufacturer and model:
- Was this working correctly on a previous version of Google Play Services? (If yes, which client library and SDK version?)
-
Attach the following:
- screenshots
- sample code
- an APK if possible.
-
Complete stacktrace when the issue occurs
wi...@gmail.com <wi...@gmail.com> #5
code:
/**
*
*/
private fun setStampView(savedInstanceState: Bundle?) {
.......
// Google Map View
mMapView = findViewById(R.id.map_view)
// Google Map Key
val mapKey = BuildConfig.MAPS_API_KEY
if(mapKey.isNotEmpty()){
val mapViewBundle = savedInstanceState?.getBundle(mapKey)
mMapView.onCreate(mapViewBundle)
}
mMapView.getMapAsync(this)
// FusedLocationProviderClient 通过结合多种定位技术(如 GPS、网络、传感器等)来提供更准确的位置数据
mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this)
// 地理坐标(经度和纬度)转换为可读的地址
mGeocoder = Geocoder(this, Locale.getDefault())
}
override fun setActityView(savedInstanceState: Bundle?) {
super.setActityView(savedInstanceState)
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.activity_layout_main)) { v, insets ->
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
// v.setPadding(systemBars.left, systemBars.top, systemBars.right, 0)
mScreenTop = systemBars.top
mScreenBottom = systemBars.bottom
val displayMetrics = resources.displayMetrics
// val screenHeight = displayMetrics.heightPixels
mScreenWidth = displayMetrics.widthPixels
// 获取广告宽度
mAdWidth = (mScreenWidth / displayMetrics.density).toInt()
mBottomSystemBarsHeight = systemBars.bottom
setBoottomSysToolViewHeight(mBottomSystemBarsHeight)
insets
}
// 设置状态栏图标颜色为白色(亮色)
WindowCompat.getInsetsController(window, window.decorView).apply {
isAppearanceLightStatusBars = false // 设置为 false 使图标变为白色
}
ImageUtils.init(applicationContext)
GPSMapCameraApp.gAppSharedPre?.let {
// 保存主界面当前是否为激活的最高界面
saveSPBoolean(it, SP_KEY_MAIN_IS_NOW_ACTIVATE, true)
}
// 埋点 上报相机拍摄页PV
logEvent(FireBaseEvent.ONE_PV, FireBaseEvent.PV_CAMERA_PAGE)
// 埋点 上报拍摄页面展示次数
logEvent(FireBaseEvent.TAKEPHOTO_PROCESS, FireBaseEvent.CAMERA_PAGE_SHOW)
// 判断是否为新用户
if (GPSMapCameraApp.gIsFirst) {
// 埋点 上报相机拍摄页PV 新用户
logEvent(FireBaseEvent.NEW_USER_PROCESS, FireBaseEvent.NEW_USER_CAMERA_PAGE)
}
// 初始化声音播放
initMediaPlayer()
// 整个Activity区域
mCLMain = findViewById(R.id.activity_layout_main)
// 设置Google广告
setGoogleAdView()
// 设置相机预览全部区域
setAllCameraPreview()
mClTop = findViewById(R.id.main_cl_top_view)
// 设置按钮
m_imgTopSetting = findViewById(R.id.main_img_top_setting)
// 设置按钮 外部区域
mRlTopSetting = findViewById(R.id.main_rl_top_setting_external)
mRlTopSetting.setOnClickListener {
// 跳转到设置界面
gotoSettingActivity()
}
// 闪光灯按钮
mImgTopFlash = findViewById(R.id.main_img_top_flash)
when (currentFlashMode) {
ImageCapture.FLASH_MODE_AUTO -> {
mImgTopFlash.setImageResource(R.mipmap.ic_camera_flash_auto)
}
ImageCapture.FLASH_MODE_OFF -> {
mImgTopFlash.setImageResource(R.mipmap.ic_camera_flash_off)
}
ImageCapture.FLASH_MODE_ON -> {
mImgTopFlash.setImageResource(R.mipmap.ic_camera_flash_on)
}
else -> {
mImgTopFlash.setImageResource(R.mipmap.ic_camera_flash_auto)
}
}
// 闪光灯按钮触摸区域
mRlTopFlash = findViewById(R.id.main_rl_top_flash_external)
mRlTopFlash.setOnClickListener {
// 显示闪光灯选择弹出对话框
// showFlashPopupWindow(mImgTopFlash)
if(::mllCameraFlashSet.isInitialized) {
if(mBShowCameraFlashSet) {
mBShowCameraFlashSet = false
// 隐藏 Camera闪光灯设置相关界面
mllCameraFlashSet.visibility = View.GONE
} else {
mBShowCameraFlashSet = true
// 显示 Camera闪光灯设置相关界面
mllCameraFlashSet.visibility = View.VISIBLE
}
}
}
// 摄像头旋转按钮
mImgTopRotate = findViewById(R.id.main_img_top_rotate)
mRlTopRotate = findViewById(R.id.main_rl_top_flash_rotate)
mRlTopRotate.setOnClickListener {
// 摄像头旋转
rotateCamera()
}
// 相机设置按钮
mImgCameraSet = findViewById(R.id.main_img_top_camera_set)
// mImgCameraSet.setImageResource(R.mipmap.ic_camera_set)
// 相机设置按钮触摸区域
mRlTopCameraSet = findViewById(R.id.main_rl_top_camera_set_external)
mRlTopCameraSet.setOnClickListener {
//
if (::mRlCameraSet.isInitialized) {
if (mBShowCameraSet) {
mBShowCameraSet = false
// 隐藏 Camera设置相关界面
mRlCameraSet.visibility = View.GONE
} else {
mBShowCameraSet = true
// 显示 Camera设置相关界面
mRlCameraSet.visibility = View.VISIBLE
}
}
}
// 聚焦Icon
mImgCameraFocus = findViewById(R.id.main_img_camera_focus)
// 覆盖在预览视图上的网格
mGridOverlayView = findViewById(R.id.main_view_camera_grid)
if (mBShowCameraSetGrid) {
mGridOverlayView.visibility = View.VISIBLE
} else {
mGridOverlayView.visibility = View.GONE
}
// 闪光界面
mViewFalsh = findViewById(R.id.main_view_falsh)
// 设置底部工具相关区域
setBottomToosView()
// 设置相机设置相关界面
setCameraSetView()
// 设置相机闪光灯模式设置相关界面
setCameraFlashSetView()
// 设置相机缩放信息界面
setZoomInfoView()
// 设置 stemp信息界面
setStampView(savedInstanceState)
// 设置横竖屏切换
setOrientationChanged()
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
mContext = this
// 新建View之前初始化
initBeforeCreateView()
enableEdgeToEdge()
// 设置
setContentView(setActivityLayout())
// 设置Actity View
setActityView(savedInstanceState)
// 新建View之后初始化
initAfterCreateView()
}
wi...@gmail.com <wi...@gmail.com> #6
build.gradle.kts(Project) buildscript { dependencies { classpath("com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.1") } }
plugins { alias(libs.plugins.android.application) apply false alias(libs.plugins.jetbrains.kotlin.android) apply false id("com.google.gms.google-services") version "4.4.2" apply false id("com.google.firebase.crashlytics") version "3.0.2" apply false }
build.gradle.kts(Module) plugins { alias(libs.plugins.android.application) alias(libs.plugins.jetbrains.kotlin.android) id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin") id("com.google.gms.google-services") id("com.google.firebase.crashlytics") }
android { namespace = "....." compileSdk = 34
signingConfigs {
create("sharedConfig") {
keyAlias = "....."
keyPassword = "....."
storeFile = file("../gps-camera-key.keystore")
storePassword = "....."
}
}
defaultConfig {
applicationId = "......."
minSdk = 21
targetSdk = 34
versionCode = 12400
versionName = "1.2.4.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
bundle {
language {
enableSplit = false
}
}
}
buildTypes {
release {
// release 模式下 BuildConfig.GIS_DEBUG_MODE 为 false
buildConfigField("boolean", "GIS_DEBUG_MODE", "false")
// 启用代码混淆
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
// signingConfig signingConfigs.release
signingConfig = signingConfigs.getByName("sharedConfig")
}
debug {
// 默认情况下,debug 模式下 BuildConfig.GIS_DEBUG_MODE 为 true
buildConfigField("boolean", "GIS_DEBUG_MODE", "true")
// 启用代码混淆
isMinifyEnabled = false
signingConfig = signingConfigs.getByName("sharedConfig")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
buildConfig = true
}
}
secrets { // Optionally specify a different file name containing your secrets. // The plugin defaults to "local.properties" propertiesFileName = "secrets.properties"
// A properties file containing default secret values. This file can be
// checked in version control.
defaultPropertiesFileName = "local.defaults.properties"
// Configure which keys should be ignored by the plugin by providing regular expressions.
// "sdk.dir" is ignored by default.
ignoreList.add("keyToIgnore") // Ignore the key "keyToIgnore"
ignoreList.add("sdk.*") // Ignore all keys matching the regexp "sdk.*"
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(libs.androidx.activity)
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.viewpager2)
implementation(libs.androidx.recyclerview)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
// ViewModel相关
implementation(libs.lifecycle.viewmodel.ktx)
implementation(libs.fragment.ktx)
implementation(libs.activity.ktx)
// CameraX核心库
implementation(libs.camera.core)
implementation(libs.camera.camera2)
implementation(libs.camera.lifecycle)
implementation(libs.camera.view)
implementation(libs.camera.video)
// CameraX KTX扩展库
implementation(libs.camera.extensions)
// Firebase
implementation(platform(libs.firebase.bom))
implementation(libs.firebase.analytics.ktx)
implementation(libs.firebase.crashlytics.ktx)
// Google
// Maps SDK for Android
implementation(libs.google.play.services.maps)
implementation(libs.google.play.services.location)
// google 广告
implementation(libs.play.services.ads)
// 动态权限申请
// implementation(libs.permissionx)
// 图片加载
implementation(libs.bumptech.glide)
// 预览图片
implementation(libs.chrisbanes.photoview)
// Lottie 动画
implementation(libs.lottie.compose)
// exoplayer
implementation(libs.google.android.exoplayer)
// AgentWeb
implementation(libs.agentweb.core)
// 语种切换框架:https://github.com/getActivity/MultiLanguages
implementation(libs.getActivity.multiLanguages)
// 网络请求相关
implementation(libs.retrofit2.retrofit)
implementation(libs.retrofit2.converter.gson)
implementation(libs.okhttp3.okhttp)
implementation(libs.okhttp3.logging.interceptor)
//
implementation(libs.me.samlss.broccoli)
// implementation("me.samlss:broccoli:1.0.0")
}
libs.version.toml [versions] ........
Firebase
firebaseBom = "33.1.2"
Maps SDK for Android
#playServicesMaps = "18.2.0" playServicesMaps = "19.0.0" playServicesLocation = "21.3.0" playServicesAds = "23.3.0"
......
[libraries] .........
Firebase
firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebaseBom" } firebase-analytics-ktx = { module = "com.google.firebase:firebase-analytics-ktx" } firebase-crashlytics-ktx = { module = "com.google.firebase:firebase-crashlytics-ktx" }
Maps SDK for Android
google-play-services-maps = { group = "com.google.android.gms", name = "play-services-maps", version.ref = "playServicesMaps" } google-play-services-location = { group = "com.google.android.gms", name = "play-services-location", version.ref = "playServicesLocation" } play-services-ads = { module = "com.google.android.gms:play-services-ads", version.ref = "playServicesAds"}
.......
Description
Hi,
We are experiencing a lot of ANRs that are reported on both Play Console & Firebase Crashlytics. The stack trace on both, points to the same class of MapView in Google Maps. I am sharing the stack trace that we are getting in Firebase Crashlytics.
Devices: 75% Vivo 9% xiaomi 13% oppo 3% OS: 58% android11 32% android12 10%
SDK Version: play-services-maps 19.0.0 play-services-location 21.3.0 play-services-ads 23.3.0
Attached is the log txt of ANR