@@ -28,7 +28,6 @@ public class BacktraceReactNative extends ReactContextBaseJavaModule {
2828 }
2929
3030 public static final String NAME = "BacktraceReactNative" ;
31- private final String _crashpadHandlerName = "/libcrashpad_handler.so" ;
3231
3332 public native void Crash ();
3433
@@ -54,43 +53,23 @@ public Boolean initialize(String minidumpSubmissionUrl, String databasePath, Rea
5453 Log .d (this .NAME , "Unsupported ABI detected." );
5554 return false ;
5655 }
57- String handlerPath = context .getApplicationInfo ().nativeLibraryDir + _crashpadHandlerName ;
5856
5957 HashMap <String , Object > attributes = readableAttributes .toHashMap ();
60-
6158 String [] keys = attributes .keySet ().toArray (new String [0 ]);
6259 String [] values = attributes .values ().toArray (new String [0 ]);
60+
6361 BacktraceCrashHandlerWrapper nativeCommunication = new BacktraceCrashHandlerWrapper ();
62+ // Always use the Java crash handler path
63+ Boolean result = nativeCommunication .initializeJavaCrashHandler (
64+ minidumpSubmissionUrl ,
65+ databasePath ,
66+ crashHandlerConfiguration .getClassPath (),
67+ keys ,
68+ values ,
69+ attachmentPaths .toArrayList ().toArray (new String [0 ]),
70+ crashHandlerConfiguration .getCrashHandlerEnvironmentVariables (this .context .getApplicationInfo ()).toArray (new String [0 ])
71+ );
6472
65- // Depending on the AGP version, the crash handler executable might be extracted from APK or not.
66- // Due to that, we need to have an option, to capture and send exceptions without the crash handler executable.
67- // We can achieve the same via Java Crash Handler - the Java class that will be executed via app_process.
68-
69- // The reason why we don't want to enable java crash handler by default is because of the proguard
70- // support and testing potential limitations of the new java crash handler.
71- Boolean result =
72- new File (handlerPath ).exists ()
73- ? nativeCommunication .initializeCrashHandler (
74- minidumpSubmissionUrl ,
75- databasePath ,
76- handlerPath ,
77- keys ,
78- values ,
79- attachmentPaths .toArrayList ().toArray (new String [0 ]),
80- false ,
81- null
82- )
83- : nativeCommunication .initializeJavaCrashHandler (
84- minidumpSubmissionUrl ,
85- databasePath ,
86- crashHandlerConfiguration .getClassPath (),
87- keys ,
88- values ,
89- attachmentPaths .toArrayList ().toArray (new String [0 ]),
90- crashHandlerConfiguration
91- .getCrashHandlerEnvironmentVariables (this .context .getApplicationInfo ())
92- .toArray (new String [0 ])
93- );
9473 return result ;
9574 }
9675
0 commit comments