Comments (8)
from androidnativebundle.
sure.
here is the gradle https://github.com/getsentry/sentry-android/blob/feat/ndk_link/sentry-sample/build.gradle.kts
and here is the cmakelist https://github.com/getsentry/sentry-android/blob/feat/ndk_link/sentry-sample/CMakeLists.txt
trying to import sentry.h here https://github.com/getsentry/sentry-android/blob/feat/ndk_link/sentry-sample/src/main/cpp/native-sample.cpp
thanks a lot.
from androidnativebundle.
i didn't see the app have dependency for the sentry-android-ndk lib, here is your app dependencies
dependencies{
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
implementation(project(":sentry-android"))
implementation(Config.Libs.appCompat)
// debugging purpose
implementation(Config.Libs.timber)
debugImplementation(Config.Libs.leakCanary)
testImplementation(kotlin(Config.kotlinStdLib, KotlinCompilerVersion.VERSION))
testImplementation(Config.TestLibs.junit)
androidTestImplementation(Config.TestLibs.espressoCore)
androidTestImplementation(Config.TestLibs.androidxCore)
androidTestImplementation(Config.TestLibs.androidxRunner)
androidTestImplementation(Config.TestLibs.androidxJunit)
androidTestUtil(Config.TestLibs.androidxOrchestrator)
}
you can try to publish your sentry-android-ndk module to maven local, and then add a dependency to app, like this implementation(com.xx.yy:sentry-android-ndk:1.0.0)
from androidnativebundle.
@howardpang ok I see, thanks for pointing it out.
actually our SDK is on jcenter
and bintray
already so no need to publish it on mavenLocal
.
The thing is, sentry-android
has the dependency of sentry-android-ndk
so it's not need to depend on it directly. maybe that's the issue, does the plugin support transitive dependencies
?
I'll try to add the dependency of sentry-android-ndk
directly as well just to check if it works.
If the plugin doesn't support transitive dependencies
, are you willing to implement it and count on me to help you out? I'd like to help :)
Thanks again.
from androidnativebundle.
actually it worked even as a transitive dependency, nice.
the thing is, it only works when the dependency is a maven dependency, but not a referenced module in the same project.
@howardpang do you have an idea why's that? thanks again.
from androidnativebundle.
the plugin is design to solve the app module depend a lib module that not in the same project with app. in your satuation, you can use another easy way to implement it. cmake support include other cmake project, here is example:
app CMakeList.txt
cmake_minimum_required(VERSION 3.4.1)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
set(mylib_src_DIR ../myndklib/src/main/cpp) # another CMakeLists.txt dir
add_subdirectory(${mylib_src_DIR}
myndklib/outputs # any name you want to set
)
include_directories(${mylib_src_DIR})
add_library( # Sets the name of the library.
nativeapp
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/main/cpp/native-app.cpp )
# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log )
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library.
nativeapp
nativelib #another library
# Links the target library to the log library
# included in the NDK.
${log-lib} )
lib CMakeLists.txt
cmake_minimum_required(VERSION 3.4.1)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
add_library( # Sets the name of the library.
nativelib
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
mylib.cpp )
# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
find_library( # Sets the name of the path variable.
log-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
log )
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library.
nativelib
# Links the target library to the log library
# included in the NDK.
${log-lib} )
from androidnativebundle.
perfect will give it a try, thanks :)
from androidnativebundle.
it worked like a charm, thank you :)
from androidnativebundle.
Related Issues (17)
- build/nativelib is empty HOT 13
- NativeLib Directory Doesn't exist on Rebuild HOT 2
- naming inconsistency HOT 1
- Support configuration cache feature HOT 3
- unable to build library after upgrade to gradle 7.2 and AGP 7.0.2 HOT 6
- Issue related with flavorDimensions HOT 13
- Usage of Gradle 8.0 deprecated features HOT 3
- Unable to build library after upgrade to gradle 7.4,AGP 7.3.0 and Flutter 3.3.9 HOT 3
- AGP 7.4 not supported HOT 2
- problem with plugins .export/.import HOT 4
- NDK warning: non-system libraries in linker flags
- Need to be ableto give filter for header files HOT 7
- Add option to pack static libs to the same AAR HOT 2
- allow specifying destination subdirectory path for header files HOT 1
- Publish lib to Maven central HOT 4
- per module export/import HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from androidnativebundle.