読者です 読者をやめる 読者になる 読者になる

3rd party libraryとしてやってはいけないログ出力

問題 : 何も成功していないのに成功したといってしまう

I/art: Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.common.api.Status>
E/FirebaseApp: Firebase API initialization failure.
         java.lang.reflect.InvocationTargetException
             at java.lang.reflect.Method.invoke(Native Method)
   at com.google.firebase.FirebaseApp.zza(Unknown Source)
   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
   at com.google.firebase.FirebaseApp.zzek(Unknown Source)
   at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
   at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
   at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
   at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
   at android.app.ActivityThread.installProvider(ActivityThread.java:5153)
   at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
   at android.app.ActivityThread.-wrap1(ActivityThread.java)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:148)
   at android.app.ActivityThread.main(ActivityThread.java:5417)
   at java.lang.reflect.Method.invoke(Native Method)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.common.api.Status
   at com.google.android.gms.internal.zzqf.<init>(Unknown Source)
   at com.google.android.gms.internal.zzqf.zzcb(Unknown Source)
   at com.google.android.gms.measurement.internal.zzn.zzwv(Unknown Source)
   at com.google.android.gms.measurement.internal.zzaa.initialize(Unknown Source)
   at com.google.android.gms.measurement.internal.zzx.<init>(Unknown Source)
   at com.google.android.gms.measurement.internal.zzab.zzbum(Unknown Source)
   at com.google.android.gms.measurement.internal.zzx.zzdo(Unknown Source)
   at com.google.android.gms.measurement.AppMeasurement.getInstance(Unknown Source)
   at java.lang.reflect.Method.invoke(Native Method) 
   at com.google.firebase.FirebaseApp.zza(Unknown Source) 
   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
   at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
   at com.google.firebase.FirebaseApp.zzek(Unknown Source) 
   at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
   at android.content.ContentProvider.attachInfo(ContentProvider.java:1748) 
   at android.content.ContentProvider.attachInfo(ContentProvider.java:1723) 
   at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
   at android.app.ActivityThread.installProvider(ActivityThread.java:5153) 
   at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748) 
   at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688) 
   at android.app.ActivityThread.-wrap1(ActivityThread.java) 
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405) 
   at android.os.Handler.dispatchMessage(Handler.java:102) 
   at android.os.Looper.loop(Looper.java:148) 
   at android.app.ActivityThread.main(ActivityThread.java:5417) 
   at java.lang.reflect.Method.invoke(Native Method) 
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
I/FirebaseInitProvider: FirebaseApp initialization successful

解決策 : 素直に失敗したことを認めましょう