2016-11-20 4 views
2

私はAndroid Studio(Google Androidプロジェクト)用のUnityプロジェクトを作成しました。私はAndroid Studioでこれを開きました。 Firebase-crashを含みます。例外をチェックするためのテストを行います。ログ内:クラッシュスタックトレースまたはミニダンプが無効

Error sending crash report 
bkz: Server did not receive report: Origin Error message: Invalid crash stacktrace or minidump. 

どうすれば修正できますか?

+0

私は同じ問題を抱えています:Unity +ネイティブFirebaseライブラリ。このバグはhttps://firebase.google.com/support/contact/bugs-features/からも報告されています。同じことをお勧めします。それは今のところ私たちができることです。 –

答えて

2

最終的に私はこの問題の最初の原因を見つけ出し、解決しました。

logcatでは、Firebaseの初期化がUnityの前に行われていることがわかります。 UnityはFirebaseのインスタンスUncaughtExceptionHandlerをそれ自身のものに置き換えます。 UnityはUnityのバージョンに関する情報を追加してThrowableを変更します。何とかスタックトレースが壊れてしまいます。この後、Throwableは、以前に登録された例外ハンドラ(Firebase)に渡されます。そして、あなたはinvalid stacktraceメッセージを見ることができます。

UncaughtExceptionHelper.java

void Awake() { 
    #if UNITY_ANDROID && !UNITY_EDITOR 
    using (AndroidJavaClass helper = new AndroidJavaClass ("com.yourcompany.UncaughtExceptionHelper")) { 
     helper.CallStatic ("restore"); 
    } 
    #endif 
} 

は、その後、あなたのAndroid Studioプロジェクトにこのクラスを追加します。このコードでスクリプトを追加するには、最初のシーンでは

は、ここにこの問題を回避するです

package com.yourcompany; 

import android.util.Log; 

import java.lang.reflect.Field; 

public class UncaughtExceptionHelper { 
    private static final String LOG_TAG = UncaughtExceptionHelper.class.getSimpleName(); 

    public static void restore() { 
     try { 
      Thread.UncaughtExceptionHandler defaultHandler = Thread.getDefaultUncaughtExceptionHandler(); 

      if (defaultHandler.getClass().getName().startsWith("com.unity3d.")) { 
       for (Field f : defaultHandler.getClass().getDeclaredFields()) { 
        f.setAccessible(true); 

        Object possibleHandler = f.get(defaultHandler); 
        if (possibleHandler instanceof Thread.UncaughtExceptionHandler) { 
         Thread.setDefaultUncaughtExceptionHandler((Thread.UncaughtExceptionHandler) possibleHandler); 

         Log.i(LOG_TAG, "restore " + possibleHandler + " instead of " + defaultHandler); 
         return; 
        } 
       } 
      } 
     } catch (Throwable ex) { 
      Log.wtf(LOG_TAG, ex); 
     } 
    } 
} 

一緒にビルドして、logcatの出力を見つけてください:

I FirebaseCrash: FirebaseCrash reporting initialized [email protected] 
I FirebaseInitProvider: FirebaseApp initialization successful 
.... 
D Unity : GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_robustness GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_sync GL_OES_EGL_image_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_depth_texture_cube_map GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_array_object GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_EXT_sRGB GL_EXT_sRGB_write_control GL_EXT 
D Unity : _texture_sRGB_decode GL_EXT_texture_filter_anisotropic GL_EXT_multisampled_render_to_texture GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_EXT_disjoint_timer_query 
.... 
I UncaughtExceptionHelper: restore [email protected] instead of [email protected] 
関連する問題