From 3075a8263d431820487183ce67bf24c2084c6d3d Mon Sep 17 00:00:00 2001 From: evnzy Date: Tue, 5 Aug 2025 14:12:07 +0700 Subject: [PATCH 01/12] Update build.gradle.kts --- build.gradle.kts | 47 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 8eee1bc..9008228 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,3 @@ -import org.jetbrains.kotlin.gradle.dsl.JvmTarget -import org.jetbrains.kotlin.gradle.dsl.KotlinVersion - plugins { alias(libs.plugins.android.library) alias(libs.plugins.kotlin.android) @@ -8,32 +5,60 @@ plugins { android { namespace = "com.kyant.taglib" - compileSdk = 36 - buildToolsVersion = "36.0.0" - ndkVersion = "29.0.13599879" + compileSdk = 34 + buildToolsVersion = "34.0.0" + ndkVersion = "29.0.13846066" defaultConfig { minSdk = 23 consumerProguardFiles("consumer-rules.pro") ndk { - abiFilters += arrayOf("arm64-v8a", "armeabi-v7a", "x86_64", "x86") + abiFilters += listOf("arm64-v8a", "armeabi-v7a") } - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } buildTypes { - release { + getByName("release") { isMinifyEnabled = false - proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) } } + externalNativeBuild { cmake { - path("src/main/cpp/CMakeLists.txt") + path = file("src/main/cpp/CMakeLists.txt") version = "4.0.2" } } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_18 + targetCompatibility = JavaVersion.VERSION_18 + } + + kotlinOptions { + apiVersion = "1.8" + languageVersion = "1.8" + jvmTarget = "18" + } + + lint { + checkReleaseBuilds = false + } +} + +kotlin { + explicitApi() +} + +dependencies { + androidTestImplementation(libs.androidx.runner) + androidTestImplementation(libs.androidx.rules) +} compileOptions { sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 From 7cb22a511499bf288ef8eaff708f1b427cb47407 Mon Sep 17 00:00:00 2001 From: evnzy Date: Tue, 5 Aug 2025 14:13:32 +0700 Subject: [PATCH 02/12] Update libs.versions.toml --- gradle/libs.versions.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ceaaf22..0eabc16 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -agp = "8.11.0" -kotlin = "2.2.0" +agp = "8.4.1" +kotlin = "1.9.23" rules = "1.6.1" runner = "1.6.2" From 8e70fe81565370fabff224803450bc7f556b67b9 Mon Sep 17 00:00:00 2001 From: evnzy Date: Tue, 5 Aug 2025 14:14:48 +0700 Subject: [PATCH 03/12] Update gradle-wrapper.properties --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ff23a68..a80b22c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From 60bbcbe5b3744a9c8b8d2ad800ee6dcbc925850f Mon Sep 17 00:00:00 2001 From: evnzy Date: Tue, 5 Aug 2025 14:16:17 +0700 Subject: [PATCH 04/12] Update CMakeLists.txt --- src/main/cpp/CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/cpp/CMakeLists.txt b/src/main/cpp/CMakeLists.txt index 683877d..6c0ba3d 100644 --- a/src/main/cpp/CMakeLists.txt +++ b/src/main/cpp/CMakeLists.txt @@ -47,3 +47,16 @@ add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD target_link_libraries(${CMAKE_PROJECT_NAME} android tag) +add_library(${CMAKE_PROJECT_NAME} SHARED + taglib.cpp + fileref_ext.cpp) + +add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_OBJCOPY} + --remove-section .comment + --remove-section .note + --strip-debug $) + +target_link_libraries(${CMAKE_PROJECT_NAME} + android + tag) From e334747d85cb50a9599e079e0d246184be10756c Mon Sep 17 00:00:00 2001 From: evnzy Date: Tue, 5 Aug 2025 14:18:09 +0700 Subject: [PATCH 05/12] Update gradle.properties --- gradle.properties | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 62f7fa9..3c1b9d5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,11 @@ -kotlin.code.style=official +lin.code.style=official #Gradle -org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M" +org.gradle.parallel=false +org.gradle.workers.max=2 +org.gradle.jvmargs=-Xmx1024M -Dfile.encoding=UTF-8 org.gradle.configuration-cache=true #Android android.useAndroidX=true -android.nonTransitiveRClass=true \ No newline at end of file +android.nonTransitiveRClass=true +android.experimental.dependency.excludeLibraryComponentsFromConstraints=true +org.gradle.configureondemand=true From 19777943367ac036d8ca9e45d37fed100a6b23fe Mon Sep 17 00:00:00 2001 From: evnzy Date: Tue, 5 Aug 2025 14:20:04 +0700 Subject: [PATCH 06/12] Update local.properties --- local.properties | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/local.properties b/local.properties index 7b5fc95..4ed95de 100644 --- a/local.properties +++ b/local.properties @@ -6,3 +6,7 @@ # header note. #Fri Nov 10 13:16:04 CST 2023 sdk.dir=C\:\\Users\\Kyant\\AppData\\Local\\Android\\Sdk + +#sdk.dir=/data/data/com.itsaky.androidide/files/home/android-sdk + +#sdk.dir=/data/data/com.termux/files/home/android-sdk From a3e688877e592c602d487ddd37e5d29670508f97 Mon Sep 17 00:00:00 2001 From: evnzy Date: Tue, 5 Aug 2025 14:57:53 +0700 Subject: [PATCH 07/12] Create NOTICE.txt Add NOTICE.txt file to comply with TagLib license requirements (Apache 2.0, LGPL 2.1, MPL 1.1). Mentioned build configuration adjustments for compatibility. --- NOTICE.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 NOTICE.txt diff --git a/NOTICE.txt b/NOTICE.txt new file mode 100644 index 0000000..b9f3d7f --- /dev/null +++ b/NOTICE.txt @@ -0,0 +1,18 @@ +NOTICE + +This project includes a compiled version of the TagLib library for Android. + +Built from: +- Android wrapper: https://github.com/Kyant0/taglib (Apache License 2.0) +- Core library: https://github.com/taglib/taglib (LGPL 2.1 / MPL 1.1) + +Some build configurations (e.g. Gradle, CMake, NDK) have been modified for compatibility. + +You are free to use, link, and distribute this binary under the respective open-source licenses. +Refer to LICENSE files or the links below for full license details: + +- Apache License 2.0: https://www.apache.org/licenses/LICENSE-2.0 +- LGPL 2.1: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html +- MPL 1.1: https://www.mozilla.org/MPL/1.1/ + +No changes have been made to the core TagLib source code. From ec453c056061b2587ccf9926f191fc6386347940 Mon Sep 17 00:00:00 2001 From: evnzy Date: Tue, 5 Aug 2025 15:43:10 +0700 Subject: [PATCH 08/12] Update README.md Improved README.md with complete integration steps, Groovy/Kotlin DSL examples, build from source guide, and proper credits to kyant0/taglib. Also added flatDir repo explanation for local AAR imports. --- README.md | 106 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 96 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 36579d6..fea1971 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,106 @@ -# TagLib +# TagLib for Android -An Android library which can read and write tags of audio files, using [TagLib](https://github.com/taglib/taglib). +An Android native library for reading and writing metadata tags in audio files — powered by TagLib. -## Add to project +# Add to Project -Download the [aar](https://github.com/Kyant0/taglib/releases) and copy it to your module's `libs` directory. +1. Download the prebuilt .aar from the build/outputs/aar/ directory after building the project manually. -```kotlin + +2. Place the `.aar` file in your app module's `libs/ directory (e.g., yourproject/app/libs/)` + + +3. Then add the dependency in your build.gradle file based on your build script: + + +```Groovy DSL +implementation files("libs/taglib-release.aar") +``` + + +```Kotlin DSL implementation(files("libs/taglib-release.aar")) ``` -## Functions -* Get and save audio properties and all metadata of audio files. -* Get and save cover art of audio files, support multiple cover arts. -## Example +4. Make sure to declare the flatDir repository in your build.gradle: + + +```Groovy DSL +repositories { flatDir { dirs 'libs' } } +``` + + +```Kotlin DSL +repositories { flatDir { dirs("libs") } } +``` + + +# Without DSL (direct manual import in IDE): + +• Open your module settings + + • Click "+" → "Import .JAR/.AAR Package" + + • Select the .aar from libs/ + + • Confirm and sync project + + + + +# Features + +Read & write audio metadata (title, artist, album, year, etc.) + +Get & save cover art (supports multiple embedded artworks) + +Read audio file properties (bitrate, duration, sample rate, etc.) + + + # Example Usage + +See `Tests.kt` for usage examples. + +# Build from Source + +To build the library manually: + +1. Clone the repository + + +2. Make sure you have `Android NDK (tested with r29+)` and `CMake (4.0.2)` installed + + +3. Run the following Gradle command: + +```Bash +./gradlew :library:assembleRelease +``` + + or + +```Bash +./gradlew assembleRelease +``` + + + +The resulting AAR will be located at: `.../build/outputs/aar/taglib-release.aar` + +You can now include this AAR in your app's libs/ directory as shown above. + +# Based on + +TagLib `(https://taglib.org/)` — C++ library for audio metadata. This version is wrapped for Android with CMake + NDK + JNI. `Forked and modified from kyant0/taglib (Apache License 2.0).` + +# License + +LGPL-2.1-or-later + +MPL-1.1 + +Apache-2.0 (from kyant0/taglib) See `NOTICE.txt` for details. + -See [Tests.kt](/src/androidTest/kotlin/Tests.kt). From 968ef773f020e5f9ec45cac121385f1a8ce6d333 Mon Sep 17 00:00:00 2001 From: evnzy Date: Tue, 5 Aug 2025 15:56:40 +0700 Subject: [PATCH 09/12] Update README.md --- README.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fea1971..46c30c0 100644 --- a/README.md +++ b/README.md @@ -95,12 +95,8 @@ You can now include this AAR in your app's libs/ directory as shown above. TagLib `(https://taglib.org/)` — C++ library for audio metadata. This version is wrapped for Android with CMake + NDK + JNI. `Forked and modified from kyant0/taglib (Apache License 2.0).` -# License - -LGPL-2.1-or-later - -MPL-1.1 - -Apache-2.0 (from kyant0/taglib) See `NOTICE.txt` for details. +# Note: +This repository is a fork of `kyant0/taglib`, originally licensed under `Apache License 2.0`. +This fork `maintains` the Android integration from the original project, while providing additional build configurations, usage documentation, and packaged artifacts (.aar) for easier adoption in Android projects. From d29f299b6c4e981b64e00fb150cef573a89e528b Mon Sep 17 00:00:00 2001 From: Evnzyriz <218711488+evnzy@users.noreply.github.com> Date: Tue, 5 Aug 2025 16:50:55 +0700 Subject: [PATCH 10/12] Update build.gradle.kts --- build.gradle.kts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 9008228..07646eb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,7 @@ plugins { alias(libs.plugins.android.library) alias(libs.plugins.kotlin.android) + id("maven-publish") } android { @@ -59,9 +60,20 @@ dependencies { androidTestImplementation(libs.androidx.runner) androidTestImplementation(libs.androidx.rules) } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 + +afterEvaluate { + publishing { + publications { + create("release") { + from(components["release"]) + + groupId = "com.github.evnzy" + artifactId = "taglib-native" + version = "1.0.3" + } + } + } +} targetCompatibility = JavaVersion.VERSION_21 } kotlin { compilerOptions { From 8b91e70046f2f227fe4be0d4955f90a51498cdad Mon Sep 17 00:00:00 2001 From: Evnzyriz <218711488+evnzy@users.noreply.github.com> Date: Tue, 5 Aug 2025 16:58:33 +0700 Subject: [PATCH 11/12] Create jitpack.yml --- jitpack.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 jitpack.yml diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000..893f482 --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,11 @@ +jdk: + - 17 + +install: + - ./gradle + + + + + +Add jitpack.yml for Java 17 compatibility From fbf23b6cddd082825f2786f70a56d7d860d682f6 Mon Sep 17 00:00:00 2001 From: Evnzyriz <218711488+evnzy@users.noreply.github.com> Date: Tue, 5 Aug 2025 17:18:20 +0700 Subject: [PATCH 12/12] Update settings.gradle.kts --- settings.gradle.kts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/settings.gradle.kts b/settings.gradle.kts index 04cda25..0627ed3 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -5,6 +5,10 @@ pluginManagement { gradlePluginPortal() } } + +enableFeaturePreview("VERSION_CATALOGS") +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + dependencyResolutionManagement { repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS repositories {