Skip to content

Commit 5903fcf

Browse files
committed
android JNI ffi
1 parent 66bc8b6 commit 5903fcf

File tree

8 files changed

+2616
-0
lines changed

8 files changed

+2616
-0
lines changed

flutter/android/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ android {
5757
jvmTarget = JavaVersion.VERSION_1_8
5858
languageVersion = "1.4"
5959
}
60+
61+
externalNativeBuild {
62+
cmake {
63+
path "src/main/cpp/CMakeLists.txt"
64+
}
65+
}
6066
}
6167

6268
dependencies {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# From dart SDK: https://github.com/dart-lang/sdk/blob/main/.clang-format
2+
3+
# Defines the Chromium style for automatic reformatting.
4+
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
5+
BasedOnStyle: Chromium
6+
7+
# clang-format doesn't seem to do a good job of this for longer comments.
8+
ReflowComments: 'false'
9+
10+
# We have lots of these. Though we need to put them all in curly braces,
11+
# clang-format can't do that.
12+
AllowShortIfStatementsOnASingleLine: 'true'
13+
14+
# Put escaped newlines into the rightmost column.
15+
AlignEscapedNewlinesLeft: false
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# jni_native_build (Build with jni:setup. Do not delete this line.)
2+
3+
# The Flutter tooling requires that developers have CMake 3.10 or later
4+
# installed. You should not increase this version, as doing so will cause
5+
# the plugin to fail to compile for some customers of the plugin.
6+
cmake_minimum_required(VERSION 3.10)
7+
8+
project(sentry_android_binding VERSION 0.0.1 LANGUAGES C)
9+
10+
add_library(sentry_android_binding SHARED
11+
"./sentry_android_binding.c"
12+
)
13+
14+
set_target_properties(sentry_android_binding PROPERTIES
15+
OUTPUT_NAME "sentry_android_binding"
16+
)
17+
18+
target_compile_definitions(sentry_android_binding PUBLIC DART_SHARED_LIB)
19+
20+
if(WIN32)
21+
set_target_properties(${TARGET_NAME} PROPERTIES
22+
LINK_FLAGS "/DELAYLOAD:jvm.dll")
23+
endif()
24+
25+
if (ANDROID)
26+
target_link_libraries(sentry_android_binding log)
27+
else()
28+
find_package(Java REQUIRED)
29+
find_package(JNI REQUIRED)
30+
include_directories(${JNI_INCLUDE_DIRS})
31+
target_link_libraries(sentry_android_binding ${JNI_LIBRARIES})
32+
endif()

0 commit comments

Comments
 (0)