-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Java crash handler on not extracted libraries (#218)
* Update native android libraries to version 3.8.3 * Update NativeClient to use JavaCrashHandler on Android when NDK is not extracted * Warning comment change
- Loading branch information
1 parent
153a6d6
commit f53f346
Showing
8 changed files
with
185 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Android/BacktraceAndroidBackgroundUnhandledExceptionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package backtraceio.library.nativeCalls; | ||
|
||
import android.util.Log; | ||
|
||
import java.util.Map; | ||
|
||
public class BacktraceCrashHandler { | ||
private static final String LOG_TAG = BacktraceCrashHandler.class.getSimpleName(); | ||
|
||
public static final String BACKTRACE_CRASH_HANDLER = "BACKTRACE_UNITY_CRASH_HANDLER"; | ||
|
||
|
||
private static native boolean handleCrash(String[] args); | ||
|
||
public static void main(String[] args) { | ||
run(args, System.getenv()); | ||
} | ||
|
||
public static boolean run(String[] args, Map<String, String> environmentVariables) { | ||
if (environmentVariables == null) { | ||
Log.e(LOG_TAG, "Cannot capture crash dump. Environment variables are undefined"); | ||
return false; | ||
} | ||
|
||
String crashHandlerLibrary = environmentVariables.get(BACKTRACE_CRASH_HANDLER); | ||
if (crashHandlerLibrary == null) { | ||
Log.e(LOG_TAG, String.format("Cannot capture crash dump. Cannot find %s environment variable", BACKTRACE_CRASH_HANDLER)); | ||
return false; | ||
} | ||
System.load(crashHandlerLibrary); | ||
|
||
boolean result = handleCrash(args); | ||
if (!result) { | ||
Log.e(LOG_TAG, String.format("Cannot capture crash dump. Invocation parameters: %s", String.join(" ", args))); | ||
return false; | ||
} | ||
|
||
Log.i(LOG_TAG, "Successfully ran crash handler code."); | ||
return true; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters