[似乎Google Map sdk在那几天引入了一个错误。在Google Play控制台中,这是日志。
java.lang.ArrayIndexOutOfBoundsException:
at com.google.maps.api.android.lib6.gmm6.vector.ct.<init> (com.google.android.gms.dynamite_mapsdynamite@201216
启动时好像google map崩溃了。
Google可能的答案(https://issuetracker.google.com/issues/1548554诊断:加载时Google Maps Platform移动SDK(iOS和Android)崩溃。
解决方法:*清除受影响的应用程序的数据(而不仅仅是缓存),或者先卸载再重新安装受影响的应用程序。
建议将代码放置在application(_:didFinishLaunchingWithOptions :)(Swift)或application:didFinishLaunchingWithOptions:(Objective-C)方法中的GMSServices初始化之前。具体来说:
let key = "GoogleMapsServerControlledParamsKey_bug_154855417"
if !UserDefaults.standard.bool(forKey: key) {
let urls = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask)
if urls.count > 0 {
let paramUrl = urls[0].appendingPathComponent("com.google.GoogleMaps/ServerControlledParams", isDirectory: false)
try? FileManager.default.removeItem(at: paramUrl)
}
UserDefaults.standard.set(true, forKey: key)
}
NSString *key = @"GoogleMapsServerControlledParamsKey_bug_154855417";
BOOL keyExists = [[NSUserDefaults standardUserDefaults] boolForKey:key];
if (!keyExists) {
NSArray<NSURL *> *array =
[[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory
inDomains:NSUserDomainMask];
if (array.count > 0) {
NSURL *url =
[array[0] URLByAppendingPathComponent:@"com.google.GoogleMaps/ServerControlledParams"
isDirectory:NO];
if (url) {
[[NSFileManager defaultManager] removeItemAtURL:url error:NULL]);
}
}
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:key];
}
一旦将其部署到您的应用中,如果希望我们帮助您加快批准速度,则可以提交Maps支持案例。请确保包括您的应用程序ID,捆绑ID和您要检查的版本。
Android的代码解决方法:
推荐的代码放置在Application.onCreate()中:
try {
SharedPreferences hasFixedGoogleBug154855417 = getSharedPreferences("google_bug_154855417", Context.MODE_PRIVATE);
if (!hasFixedGoogleBug154855417.contains("fixed")) {
File corruptedZoomTables = new File(getFilesDir(), "ZoomTables.data");
File corruptedSavedClientParameters = new File(getFilesDir(), "SavedClientParameters.data.cs");
File corruptedClientParametersData =
new File(
getFilesDir(),
"DATA_ServerControlledParametersManager.data.v1."
+ getBaseContext().getPackageName());
corruptedZoomTables.delete();
corruptedSavedClientParameters.delete();
corruptedClientParametersData.delete();
hasFixedGoogleBug154855417.edit().putBoolean("fixed", true).apply();
}
} catch (Exception e) {
}
try {
val sharedPreferences = getSharedPreferences("google_bug_154855417", Context.MODE_PRIVATE)
if (!sharedPreferences.contains("fixed")) {
val corruptedZoomTables = File(filesDir, "ZoomTables.data")
val corruptedSavedClientParameters = File(filesDir, "SavedClientParameters.data.cs")
val corruptedClientParametersData = File(filesDir, "DATA_ServerControlledParametersManager.data.v1.${packageName}")
corruptedZoomTables.delete()
corruptedSavedClientParameters.delete()
corruptedClientParametersData.delete()
sharedPreferences.edit().putBoolean("fixed", true).apply()
}
} catch (exception: Exception) {
}