Skip to content

Commit 5f230c1

Browse files
markushiromtsn
andauthored
Update Android docs around NDK prefab support (#14903)
Instead of the old and outdated 3rd party plugin. ## DESCRIBE YOUR PR *Tell us what you're changing and why. If your PR **resolves an issue**, please link it so it closes automatically.* ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [x] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## LEGAL BOILERPLATE <!-- Sentry employees and contractors can delete or ignore this section. --> Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms. ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/) --------- Co-authored-by: Roman Zavarnitsyn <[email protected]>
1 parent c9e1888 commit 5f230c1

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

docs/platforms/android/configuration/using-ndk.mdx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The Android Native Development Kit (NDK) allows you to implement parts of your a
88

99
NDK integration is packed with the SDK. The package `sentry-android-ndk` works by bundling Sentry's native SDK, [`sentry-native`](/platforms/native/). As a result, even if a native library in your app causes the crash, Sentry is able to capture it.
1010

11-
You can [disable the NDK integration](#disable-ndk-integration), use our Sentry Android SDK [without the NDK](#using-the-sdk-without-the-ndk).
11+
You can [disable the NDK integration](#disable-ndk-integration), or use our Sentry Android SDK [without the NDK](#using-the-sdk-without-the-ndk).
1212

1313
## Symbolicate Stack Traces
1414

@@ -21,39 +21,39 @@ Please check the full documentation on [uploading files](/platforms/android/data
2121

2222
## Allowing the Compiler to Link Libraries
2323

24-
To use the Android NDK in your native code, include the Sentry NDK libraries into your project so that the compiler can link the libraries during the build.
24+
To use the Android NDK in your native code, include the `sentry-native` NDK libraries so the compiler can link them during the build. Use Android prefab to consume Sentry's prebuilt packages and link them in your `CMakeLists.txt`.
2525

26-
To do so, use the AndroidNativeBundle Gradle plugin that copies the native libraries from the Sentry NDK into the location that can provide links via the `CmakeLists.txt` configuration file.
26+
<Alert>
2727

28-
First, we need to declare the dependency in the project build.gradle file:
28+
Android prefab support can only be used with Sentry Android SDK version 8.0.0 and above.
2929

30-
```groovy {filename:build.gradle}
31-
buildscript {
32-
repositories {
33-
mavenCentral()
34-
}
30+
</Alert>
31+
32+
Enable prefab and add the sentry-native ndk dependency directly to your module:
3533

36-
dependencies {
37-
// Add the line below, the plugin that copies the binaries
38-
// https://github.com/howardpang/androidNativeBundle/releases
39-
classpath 'io.github.howardpang:androidNativeBundle:{version}'
34+
```kotlin {filename:app/build.gradle}
35+
android {
36+
buildFeatures {
37+
prefab = true
4038
}
4139
}
42-
```
43-
44-
Once the dependency is declared, you can use it in the application `build.gradle`:
4540

46-
```groovy
47-
apply plugin: 'com.ydq.android.gradle.native-aar.import'
41+
dependencies {
42+
// The version MUST match with the version the Sentry Android SDK is using.
43+
// See https://github.com/getsentry/sentry-java/blob/{{@inject packages.version('sentry.java.android', '8.21.1') }}/gradle/libs.versions.toml
44+
implementation("io.sentry:sentry-native-ndk:<version>")
45+
}
4846
```
4947

50-
Then update the `CmakeLists.txt` configuration to link the Sentry NDK libraries:
48+
Link the pre-built packages with your native code
5149

52-
```
53-
# include paths generated by androidNativeBundle
54-
include (${ANDROID_GRADLE_NATIVE_BUNDLE_PLUGIN_MK})
55-
# change native-lib to your native lib's name
56-
target_link_libraries(native-lib ${ANDROID_GRADLE_NATIVE_MODULES})
50+
```text {filename:app/CMakeLists.txt}
51+
find_package(sentry-native-ndk REQUIRED CONFIG)
52+
53+
target_link_libraries(<app> PRIVATE
54+
sentry-native-ndk::sentry-android
55+
sentry-native-ndk::sentry
56+
)
5757
```
5858

5959
Now you can use the Sentry NDK API just by including the `sentry.h` in your code:

0 commit comments

Comments
 (0)