diff --git a/ktaglib/build.gradle b/ktaglib/build.gradle index 72a311487..af386cb7c 100644 --- a/ktaglib/build.gradle +++ b/ktaglib/build.gradle @@ -1,3 +1,5 @@ +import org.apache.tools.ant.taskdefs.condition.Os + plugins { id 'com.android.library' id 'org.jetbrains.kotlin.android' @@ -41,12 +43,21 @@ android { } } -dependencies { +task assembleTaglib(type: Exec) { + def jniDir = "$projectDir/src/main/cpp/" + def libs = new File("$jniDir/taglib/pkg") + if (libs.exists()) { + commandLine "true" + return + } + commandLine "sh", "-c", "$jniDir/build_taglib.sh $android.ndkDirectory" +} - implementation 'androidx.core:core-ktx:1.15.0' - implementation 'androidx.appcompat:appcompat:1.7.0' - implementation 'com.google.android.material:material:1.12.0' - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.2.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' -} \ No newline at end of file +afterEvaluate { + preDebugBuild.dependsOn assembleTaglib + preReleaseBuild.dependsOn assembleTaglib +} + +clean { + delete "$projectDir/src/main/jni/ffmpeg/android-libs/" +} diff --git a/ktaglib/src/main/cpp/CMakeLists.txt b/ktaglib/src/main/cpp/CMakeLists.txt index 42230ee26..712ecd476 100644 --- a/ktaglib/src/main/cpp/CMakeLists.txt +++ b/ktaglib/src/main/cpp/CMakeLists.txt @@ -25,7 +25,7 @@ project("ktaglib") # for GameActivity/NativeActivity derived applications, the same library name must be # used in the AndroidManifest.xml file. set(taglib_location "${CMAKE_CURRENT_SOURCE_DIR}/taglib") -set(taglib_pkg "${taglib_location}/android-libs/${ANDROID_ABI}") +set(taglib_pkg "${taglib_location}/pkg/${ANDROID_ABI}") set(taglib_lib "${taglib_pkg}/lib") set(taglib_include "${taglib_pkg}/include") diff --git a/ktaglib/src/main/java/com/example/ktaglib/KTagLib.kt b/ktaglib/src/main/java/com/example/ktaglib/KTagLib.kt index 388d4ef9a..f11da9fe8 100644 --- a/ktaglib/src/main/java/com/example/ktaglib/KTagLib.kt +++ b/ktaglib/src/main/java/com/example/ktaglib/KTagLib.kt @@ -11,4 +11,4 @@ object KTagLib { * which is packaged with this application. */ external fun stringFromJNI(): String -}b \ No newline at end of file +} \ No newline at end of file