Google Analytics blocks Android App

前端 未结 3 1481
孤城傲影
孤城傲影 2020-12-01 06:33

I use Google Analytics in my Android App and it works well. After updating the SDK (google play service) to the current version (6587000) the app hangs up at startup at foll

3条回答
  •  感动是毒
    2020-12-01 06:47

    I had the same ANR issue every time I was calling GoogleAnalytics.getInstance(this). The problem seems to appear when the Google Play Services version in the app is not matching the one installed on the device.

    I solved this by checking if Google Play Services is "available":

    if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS) {
        GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
        // Create your tracker...
    }
    

提交回复
热议问题