Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
check API version to init NDK and also add example how to disable NDK…
… on sample manifest
  • Loading branch information
Manoel Aranda Neto committed Oct 24, 2019
commit ae6cef8ed0e28f20e2d65afa8de117db97a201de
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.sentry.android.core;

import android.content.Context;
import android.os.Build;
import io.sentry.core.ILogger;
import io.sentry.core.SentryLevel;
import io.sentry.core.SentryOptions;
Expand All @@ -25,7 +26,7 @@ static void init(SentryOptions options, Context context, ILogger logger) {
options.addEventProcessor(new DefaultAndroidEventProcessor(context, options));
options.setSerializer(new AndroidSerializer(options.getLogger()));

if (options.isEnableNdk()) {
if (options.isEnableNdk() && isNdkAvailable()) {
try {
// TODO: Create Integrations interface and use that to initialize NDK
Class<?> cls = Class.forName("io.sentry.android.ndk.SentryNdk");
Expand All @@ -50,4 +51,8 @@ private static void createsEnvelopeDirPath(SentryOptions options, Context contex
}
options.setCacheDirPath(envelopesDir.getAbsolutePath());
}

private static boolean isNdkAvailable() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we settling on the fact that NDK support will not be available on API < 21?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ninniuz for the first release, probably yes, we have a system blocker and trying to find a workaround.
JFYI dl_iterate_phdr method only available API >= 21
https://android.googlesource.com/platform/bionic/+/master/docs/status.md

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, tried to build the NDK feature branch on API 14 and got an error on that method :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might have a workaround, parsing /proc/PID/maps by hand and getting what we need.
but still thinking if it's a good idea.

return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
}
}
4 changes: 4 additions & 0 deletions sentry-sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@

<meta-data android:name="io.sentry.dsn" android:value="https://[email protected]/123" />
<meta-data android:name="io.sentry.debug" android:value="true" />

<!-- <meta-data android:name="io.sentry.auto-init" android:value="false" /> // how to disable the auto-init-->

<!-- <meta-data android:name="io.sentry.ndk" android:value="false" /> // how to disable the NDK-->
<!-- tools:node="remove" />-->
</application>
</manifest>