Skip to content

Commit edf89e3

Browse files
authored
docs: mention about build gradle (#629)
1 parent 3480813 commit edf89e3

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

packages/audiodocs/docs/guides/create-your-own-effect.mdx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,26 @@ target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC
177177

178178
add_library(react-native-audio-api SHARED IMPORTED)
179179
string(TOLOWER ${CMAKE_BUILD_TYPE} BUILD_TYPE_LOWER)
180-
# we need to find where original library was built
180+
# we need to import built library from android directory
181181
set_target_properties(react-native-audio-api PROPERTIES IMPORTED_LOCATION
182182
${AUDIO_API_DIR}/android/build/intermediates/merged_native_libs/${BUILD_TYPE_LOWER}/merge${CMAKE_BUILD_TYPE}NativeLibs/out/lib/${CMAKE_ANDROID_ARCH_ABI}/libreact-native-audio-api.so
183183
)
184184
target_link_libraries(${CMAKE_PROJECT_NAME} react-native-audio-api android log)
185185
```
186186
187+
Last part that is required for you to do, is to add following lines to `build.gradle` file located in `android/app` directory.
188+
189+
```Cmake
190+
evaluationDependsOn(":react-native-audio-api")
191+
192+
afterEvaluate {
193+
tasks.getByName("buildCMakeDebug").dependsOn(findProject(":react-native-audio-api").tasks.getByName("mergeDebugNativeLibs"))
194+
tasks.getByName("buildCMakeRelWithDebInfo").dependsOn(findProject(":react-native-audio-api").tasks.getByName("mergeReleaseNativeLibs"))
195+
}
196+
```
197+
198+
Since in `CmakeLists.txt` we depend on libreact-native-audio-api.so, we need to make sure that building an app will be invoked after library is existing.
199+
187200
## Final touches
188201
189202
Last part is to finally onboard your custom module to your app, by creating typescript interface that would map c++ layer.

0 commit comments

Comments
 (0)