Google Maps api SDK崩溃ArrayIndexOutOfBoundsException

问题描述 投票:0回答:1

[似乎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崩溃了。

android google-maps google-maps-android-api-2 indexoutofboundsexception
1个回答
0
投票

Google可能的答案(https://issuetracker.google.com/issues/1548554诊断:加载时Google Maps Platform移动SDK(iOS和Android)崩溃。

解决方法:*清除受影响的应用程序的数据(而不仅仅是缓存),或者先卸载再重新安装受影响的应用程序。

  • iOS的代码解决方法:

建议将代码放置在application(_:didFinishLaunchingWithOptions :)(Swift)或application:didFinishLaunchingWithOptions:(Objective-C)方法中的GMSServices初始化之前。具体来说:

Swift:

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)
}

Objective-C:

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()中:

    Java

    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) {
    
    }
    
© www.soinside.com 2019 - 2024. All rights reserved.