Forum Xamarin Xamarin.iOS

Random FirebaseApp.InitializeApp Failure Causes?

alaskanroguealaskanrogue USMember ✭✭✭
edited December 2019 in Xamarin.iOS

During OnCreate, on calling FirebaseApp.InitializeApp, I am experiencing random errors:

java.Lang.RuntimeException: 'Unable to instantiate service md51205915cfaa299c43c140xxxxxxxx.FirebaseService: java.lang.ClassNotFoundException: Didn't find class "md51205915cfaa299c43c140xxxxxxxx.FirebaseService" on path: DexPathList[[zip file "/data/app/com.identitycheckpoint.sentry-PHjVUEubnFXUIUCH9PBDkg==/base.apk"],nativeLibraryDirectories=[/data/app/com.identitycheckpoint.sentry-PHjVUEubnFXUIUCH9PBDkg==/lib/arm64, /data/app/com.identitycheckpoint.sentry-PHjVUEubnFXUIUCH9PBDkg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]'

The next debugging may or may not succeed; but in multiple debugging attempts, there are successes. Any ideas?

Answers

  • LeonLuLeonLu Member, Xamarin Team Xamurai
    edited December 2019

    Before you calling the FirebaseApp.InitializeApp, did your check the google play service is running using following code.
    In the following example, the OnCreate method will verify that Google Play Services is available before the app attempts to use FCM services. Add the following method to the MainActivity class:

     public bool IsPlayServicesAvailable ()
     {
      int resultCode = GoogleApiAvailability.Instance.IsGooglePlayServicesAvailable (this);
      if (resultCode != ConnectionResult.Success)
     {
        if (GoogleApiAvailability.Instance.IsUserResolvableError (resultCode))
            msgText.Text = GoogleApiAvailability.Instance.GetErrorString (resultCode);
        else
        {
            msgText.Text = "This device is not supported";
            Finish ();
        }
        return false;
      }
       else
      {
        msgText.Text = "Google Play Services is available.";
        return true;
       }
     }
    

    And please try to cleaning the solution and rebuilding the project (Build > Clean Solution, Build > Rebuild Solution).

  • alaskanroguealaskanrogue USMember ✭✭✭

    @LeonLu Yes I am checking the availability of the Play services. My method code is slightly different, but basically the same functionality. I also constantly clean and delete the bin and obj folders before most rebuilds.

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    Could you share a demo for this issue? Because we cannot re-produce it.

  • alaskanroguealaskanrogue USMember ✭✭✭

    This issue has been taken over by @jezh on the Xamarin.Android forum where I re-posted it when I realize that this was the iOS forum: https://forums.xamarin.com/discussion/comment/399160#Comment_399160 They have a demo.

Sign In or Register to comment.