diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index e1a7820d..8cd07616 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -49,3 +49,4 @@ jobs:
targetPlatform: ${{ matrix.targetPlatform }}
projectPath: ${{ matrix.projectPath }}/
allowDirtyBuild: true
+
\ No newline at end of file
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 001e9304..0bb62ebf 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -18,9 +18,10 @@ jobs:
projectPath:
- test-package
unityVersion:
- - 2022.3.19f1
- - 2019.4.40f1
- - 2020.3.48f1
+ # Pending LTS License
+ #- 2021.3.48f1
+ #- 6000.0.38f1
+ - 2022.3.56f1
steps:
- name: Checkout Repo
uses: actions/checkout@v4
diff --git a/Android/lib/arm64-v8a/libbacktrace-native.so b/Android/lib/arm64-v8a/libbacktrace-native.so
index bf89d36b..c7acd6ce 100644
Binary files a/Android/lib/arm64-v8a/libbacktrace-native.so and b/Android/lib/arm64-v8a/libbacktrace-native.so differ
diff --git a/Android/lib/arm64-v8a/libbacktrace-native.so.meta b/Android/lib/arm64-v8a/libbacktrace-native.so.meta
index e5e54589..8daba069 100644
--- a/Android/lib/arm64-v8a/libbacktrace-native.so.meta
+++ b/Android/lib/arm64-v8a/libbacktrace-native.so.meta
@@ -31,4 +31,4 @@ PluginImporter:
DefaultValueInitialized: true
userData:
assetBundleName:
- assetBundleVariant:
+ assetBundleVariant:
\ No newline at end of file
diff --git a/Android/lib/arm64-v8a/libcrashpad_handler.so b/Android/lib/arm64-v8a/libcrashpad_handler.so
deleted file mode 100644
index ce674e06..00000000
Binary files a/Android/lib/arm64-v8a/libcrashpad_handler.so and /dev/null differ
diff --git a/Android/lib/arm64-v8a/libnative-lib.so b/Android/lib/arm64-v8a/libnative-lib.so
index 6ac86514..b5c5b398 100644
Binary files a/Android/lib/arm64-v8a/libnative-lib.so and b/Android/lib/arm64-v8a/libnative-lib.so differ
diff --git a/Android/lib/arm64-v8a/libnative-lib.so.meta b/Android/lib/arm64-v8a/libnative-lib.so.meta
index a5b3e999..1ba12a2b 100644
--- a/Android/lib/arm64-v8a/libnative-lib.so.meta
+++ b/Android/lib/arm64-v8a/libnative-lib.so.meta
@@ -31,4 +31,4 @@ PluginImporter:
DefaultValueInitialized: true
userData:
assetBundleName:
- assetBundleVariant:
+ assetBundleVariant:
\ No newline at end of file
diff --git a/Android/lib/armeabi-v7a/libbacktrace-native.so b/Android/lib/armeabi-v7a/libbacktrace-native.so
index 6e3e2700..5cdb43d8 100644
Binary files a/Android/lib/armeabi-v7a/libbacktrace-native.so and b/Android/lib/armeabi-v7a/libbacktrace-native.so differ
diff --git a/Android/lib/armeabi-v7a/libbacktrace-native.so.meta b/Android/lib/armeabi-v7a/libbacktrace-native.so.meta
index 9b7c94d2..515e7fc3 100644
--- a/Android/lib/armeabi-v7a/libbacktrace-native.so.meta
+++ b/Android/lib/armeabi-v7a/libbacktrace-native.so.meta
@@ -31,4 +31,4 @@ PluginImporter:
DefaultValueInitialized: true
userData:
assetBundleName:
- assetBundleVariant:
+ assetBundleVariant:
\ No newline at end of file
diff --git a/Android/lib/armeabi-v7a/libcrashpad_handler.so b/Android/lib/armeabi-v7a/libcrashpad_handler.so
deleted file mode 100644
index de4e0eb1..00000000
Binary files a/Android/lib/armeabi-v7a/libcrashpad_handler.so and /dev/null differ
diff --git a/Android/lib/armeabi-v7a/libcrashpad_handler.so.meta b/Android/lib/armeabi-v7a/libcrashpad_handler.so.meta
deleted file mode 100644
index 13e25fcb..00000000
--- a/Android/lib/armeabi-v7a/libcrashpad_handler.so.meta
+++ /dev/null
@@ -1,34 +0,0 @@
-fileFormatVersion: 2
-guid: abbc9b9f2a6abb441a1741aae89ffa8c
-PluginImporter:
- externalObjects: {}
- serializedVersion: 2
- iconMap: {}
- executionOrder: {}
- defineConstraints: []
- isPreloaded: 1
- isOverridable: 0
- isExplicitlyReferenced: 0
- validateReferences: 1
- platformData:
- - first:
- '': Any
- second:
- enabled: 0
- settings:
- Exclude Android: 0
- - first:
- Android: Android
- second:
- enabled: 1
- settings:
- CPU: ARMv7
- - first:
- Editor: Editor
- second:
- enabled: 0
- settings:
- DefaultValueInitialized: true
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Android/lib/armeabi-v7a/libnative-lib.so b/Android/lib/armeabi-v7a/libnative-lib.so
index de7eeea3..eae5dccd 100644
Binary files a/Android/lib/armeabi-v7a/libnative-lib.so and b/Android/lib/armeabi-v7a/libnative-lib.so differ
diff --git a/Android/lib/armeabi-v7a/libnative-lib.so.meta b/Android/lib/armeabi-v7a/libnative-lib.so.meta
index 9b46160f..098fea00 100644
--- a/Android/lib/armeabi-v7a/libnative-lib.so.meta
+++ b/Android/lib/armeabi-v7a/libnative-lib.so.meta
@@ -31,4 +31,4 @@ PluginImporter:
DefaultValueInitialized: true
userData:
assetBundleName:
- assetBundleVariant:
+ assetBundleVariant:
\ No newline at end of file
diff --git a/Android/lib/x86/libbacktrace-native.so b/Android/lib/x86/libbacktrace-native.so
index 5999768e..84ca3ff0 100644
Binary files a/Android/lib/x86/libbacktrace-native.so and b/Android/lib/x86/libbacktrace-native.so differ
diff --git a/Android/lib/x86/libbacktrace-native.so.meta b/Android/lib/x86/libbacktrace-native.so.meta
index 7e2285fa..b8b46e4e 100644
--- a/Android/lib/x86/libbacktrace-native.so.meta
+++ b/Android/lib/x86/libbacktrace-native.so.meta
@@ -31,5 +31,4 @@ PluginImporter:
DefaultValueInitialized: true
userData:
assetBundleName:
- assetBundleVariant:
-
+ assetBundleVariant:
\ No newline at end of file
diff --git a/Android/lib/x86/libcrashpad_handler.so b/Android/lib/x86/libcrashpad_handler.so
deleted file mode 100644
index 32b2a0e1..00000000
Binary files a/Android/lib/x86/libcrashpad_handler.so and /dev/null differ
diff --git a/Android/lib/x86/libnative-lib.so b/Android/lib/x86/libnative-lib.so
index a31e67a3..ee4d9f0a 100644
Binary files a/Android/lib/x86/libnative-lib.so and b/Android/lib/x86/libnative-lib.so differ
diff --git a/Android/lib/x86_64.meta b/Android/lib/x86_64.meta
new file mode 100644
index 00000000..438975da
--- /dev/null
+++ b/Android/lib/x86_64.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 79839d38ef62344c9b942cb39e0bf9e4
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Android/lib/x86_64/libbacktrace-native.so b/Android/lib/x86_64/libbacktrace-native.so
new file mode 100644
index 00000000..badafb26
Binary files /dev/null and b/Android/lib/x86_64/libbacktrace-native.so differ
diff --git a/Android/lib/x86/libcrashpad_handler.so.meta b/Android/lib/x86_64/libbacktrace-native.so.meta
similarity index 87%
rename from Android/lib/x86/libcrashpad_handler.so.meta
rename to Android/lib/x86_64/libbacktrace-native.so.meta
index 9c627b76..6bb7a32f 100644
--- a/Android/lib/x86/libcrashpad_handler.so.meta
+++ b/Android/lib/x86_64/libbacktrace-native.so.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 5a073faa848d354438619cc83dd986ce
+guid: 9efa55c470a48419289dedd54d4e3d77
PluginImporter:
externalObjects: {}
serializedVersion: 2
@@ -22,7 +22,7 @@ PluginImporter:
second:
enabled: 1
settings:
- CPU: x86
+ CPU: x86_64
- first:
Editor: Editor
second:
@@ -31,4 +31,4 @@ PluginImporter:
DefaultValueInitialized: true
userData:
assetBundleName:
- assetBundleVariant:
+ assetBundleVariant:
\ No newline at end of file
diff --git a/Android/lib/x86_64/libnative-lib.so b/Android/lib/x86_64/libnative-lib.so
new file mode 100644
index 00000000..21152402
Binary files /dev/null and b/Android/lib/x86_64/libnative-lib.so differ
diff --git a/Android/lib/arm64-v8a/libcrashpad_handler.so.meta b/Android/lib/x86_64/libnative-lib.so.meta
similarity index 87%
rename from Android/lib/arm64-v8a/libcrashpad_handler.so.meta
rename to Android/lib/x86_64/libnative-lib.so.meta
index 5c0b1560..b9f5b461 100644
--- a/Android/lib/arm64-v8a/libcrashpad_handler.so.meta
+++ b/Android/lib/x86_64/libnative-lib.so.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 9f822f0b9ecf6e14a82e3576ad816db3
+guid: b46d80933ef3f4f709ec1e5943584e02
PluginImporter:
externalObjects: {}
serializedVersion: 2
@@ -22,7 +22,7 @@ PluginImporter:
second:
enabled: 1
settings:
- CPU: ARM64
+ CPU: x86_64
- first:
Editor: Editor
second:
@@ -31,4 +31,4 @@ PluginImporter:
DefaultValueInitialized: true
userData:
assetBundleName:
- assetBundleVariant:
+ assetBundleVariant:
\ No newline at end of file
diff --git a/Runtime/Native/Android/NativeClient.cs b/Runtime/Native/Android/NativeClient.cs
index 08c0c7f2..c4b235d5 100644
--- a/Runtime/Native/Android/NativeClient.cs
+++ b/Runtime/Native/Android/NativeClient.cs
@@ -22,8 +22,6 @@ namespace Backtrace.Unity.Runtime.Native.Android
internal sealed class NativeClient : NativeClientBase, INativeClient
{
private const string CallbackMethodName = "OnAnrDetected";
- [DllImport("backtrace-native")]
- private static extern bool Initialize(IntPtr submissionUrl, IntPtr databasePath, IntPtr handlerPath, IntPtr keys, IntPtr values, IntPtr attachments, bool enableClientSideUnwinding, int unwindingMode);
[DllImport("backtrace-native")]
private static extern bool InitializeJavaCrashHandler(IntPtr submissionUrl, IntPtr databasePath, IntPtr classPath, IntPtr keys, IntPtr values, IntPtr attachments, IntPtr environmentVariables);
@@ -86,11 +84,6 @@ private void SetDefaultAttributeMaps()
// Unity-Android native interface path
private const string _namespace = "backtraceio.unity";
- ///
- /// unwinding mode
- ///
- private UnwindingMode UnwindingMode = UnwindingMode.LOCAL_DUMPWITHOUTCRASH;
-
///
/// Path to class responsible for detecting ANRs occurred by Java code.
///
@@ -131,7 +124,6 @@ private void SetDefaultAttributeMaps()
///
private AndroidJavaObject _unhandledExceptionWatcher;
- private readonly bool _enableClientSideUnwinding = false;
public string GameObjectName { get; internal set; }
public NativeClient(BacktraceConfiguration configuration, BacktraceBreadcrumbs breadcrumbs, IDictionary clientAttributes, IEnumerable attachments, string gameObjectName) : base(configuration, breadcrumbs)
{
@@ -141,9 +133,7 @@ public NativeClient(BacktraceConfiguration configuration, BacktraceBreadcrumbs b
{
return;
}
-#if UNITY_2019_2_OR_NEWER
- _enableClientSideUnwinding = _configuration.ClientSideUnwinding;
-#endif
+
HandlerANR = _configuration.HandleANR;
HandleNativeCrashes(clientAttributes, attachments);
if (!configuration.ReportFilterType.HasFlag(Types.ReportFilterType.Hang))
@@ -246,8 +236,16 @@ private void HandleNativeCrashes(IDictionary backtraceAttributes
Debug.LogWarning("Backtrace native integration status: Disabled NDK integration");
return;
}
+
var databasePath = _configuration.CrashpadDatabasePath;
- if (string.IsNullOrEmpty(databasePath) || !Directory.Exists(_configuration.GetFullDatabasePath()))
+ var fullDatabasePath = _configuration.GetFullDatabasePath();
+
+ if (string.IsNullOrEmpty(databasePath) || string.IsNullOrEmpty(fullDatabasePath))
+ {
+ Debug.LogWarning("Backtrace native integration status: database path undefined");
+ return;
+ }
+ if (!Directory.Exists(fullDatabasePath))
{
Debug.LogWarning("Backtrace native integration status: database path doesn't exist");
return;
@@ -261,6 +259,7 @@ private void HandleNativeCrashes(IDictionary backtraceAttributes
int apiLevel;
if (apiLevelString == null || !int.TryParse(apiLevelString, out apiLevel))
{
+ Debug.LogWarning("Backtrace native integration status: Cannot determine Android API level");
return;
}
@@ -275,25 +274,29 @@ private void HandleNativeCrashes(IDictionary backtraceAttributes
var minidumpUrl = new BacktraceCredentials(_configuration.GetValidServerUrl()).GetMinidumpSubmissionUrl().ToString();
+ // Resolve native library directory
var libDirectory = GetNativeDirectoryPath();
if (string.IsNullOrEmpty(libDirectory) || !Directory.Exists(libDirectory))
{
libDirectory = GuessNativeDirectoryPath();
}
- const string crashpadHandlerName = "libcrashpad_handler.so";
- var crashpadHandlerPath = Path.Combine(libDirectory, crashpadHandlerName);
- CaptureNativeCrashes = CanInitializeExecutableCrashHandler(libDirectory, crashpadHandlerPath)
- ? InitializeExecutableCrashHandler(minidumpUrl, databasePath, crashpadHandlerPath, attachments)
- : InitializeJavaCrashHandler(minidumpUrl, databasePath, backtraceAttributes["device.abi"], libDirectory, attachments);
+ if (string.IsNullOrEmpty(libDirectory) || !Directory.Exists(libDirectory))
+ {
+ Debug.LogWarning("Backtrace native integration status: Cannot resolve native library directory");
+ return;
+ }
+ CaptureNativeCrashes = InitializeJavaCrashHandler(minidumpUrl, databasePath, backtraceAttributes["device.abi"], libDirectory, attachments);
+
if (!CaptureNativeCrashes)
{
- Debug.LogWarning("Backtrace native integration status: Cannot initialize Crashpad client");
+ Debug.LogWarning("Backtrace native integration status: Cannot initialize Java crash handler");
return;
}
+
foreach (var attribute in backtraceAttributes)
- {
+ {
AddAttribute(AndroidJNI.NewStringUTF(attribute.Key), AndroidJNI.NewStringUTF(attribute.Value));
}
@@ -305,25 +308,7 @@ private void HandleNativeCrashes(IDictionary backtraceAttributes
// don't add attributes that can change over the time to initialization method attributes. Crashpad will prevent from
// overriding them on game runtime. ANRs/OOMs methods can override error.type attribute, so we shouldn't pass error.type
// attribute via attributes parameters.
- AddAttribute(
- AndroidJNI.NewStringUTF(ErrorTypeAttribute),
- AndroidJNI.NewStringUTF(CrashType));
- }
-
- private bool CanInitializeExecutableCrashHandler(String nativeLibraryDirectory, String handlerPath) {
- return Directory.Exists(nativeLibraryDirectory) && File.Exists(handlerPath);
- }
-
- private bool InitializeExecutableCrashHandler(String minidumpUrl, String databasePath, String crashpadHandlerPath, IEnumerable attachments) {
- return Initialize(
- AndroidJNI.NewStringUTF(minidumpUrl),
- AndroidJNI.NewStringUTF(databasePath),
- AndroidJNI.NewStringUTF(crashpadHandlerPath),
- AndroidJNIHelper.ConvertToJNIArray(new string[0]),
- AndroidJNIHelper.ConvertToJNIArray(new string[0]),
- AndroidJNIHelper.ConvertToJNIArray(attachments.ToArray()),
- _enableClientSideUnwinding,
- (int)UnwindingMode);
+ AddAttribute(AndroidJNI.NewStringUTF(ErrorTypeAttribute), AndroidJNI.NewStringUTF(CrashType));
}
private bool InitializeJavaCrashHandler(String minidumpUrl, String databasePath, String deviceAbi, String nativeDirectory, IEnumerable attachments) {