Skip to content

Android library as Android Archive (AAR)#2592

Open
cjee21 wants to merge 3 commits into
MediaArea:masterfrom
cjee21:android-lib
Open

Android library as Android Archive (AAR)#2592
cjee21 wants to merge 3 commits into
MediaArea:masterfrom
cjee21:android-lib

Conversation

@cjee21
Copy link
Copy Markdown
Contributor

@cjee21 cjee21 commented May 9, 2026

As previously discussed at #2370 (comment)

Not sure if this is wanted but I just make a PR here with a PoC of building MediaInfoLib Android library as an AAR. Using AAR is documented at https://developer.android.com/studio/projects/android-library and is used by other libraries such as libsignal, c2pa and geckoview. Prefab is documented at https://developer.android.com/build/native-dependencies. AARs can be published to repositories as well for direct use in gradle projects.

This PR implements both JNI (with Kotlin wrapper from official app included) and C interface in the AAR.

@cjee21
Copy link
Copy Markdown
Contributor Author

cjee21 commented May 11, 2026

Oh, and to verify the authenticity of the gradle-wrapper.jar binary in this PR, can find its SHA-256 here: https://gradle.org/release-checksums/

@JeromeMartinez
Copy link
Copy Markdown
Member

Not sure if this is wanted

This is wanted, for sure! We try to publish everywhere, just that we need help when we don't know much, and your help is precious.
We add that to our backlog (we still need to understand and test it).

@cjee21
Copy link
Copy Markdown
Contributor Author

cjee21 commented May 12, 2026

We try to publish everywhere

The Rust wrapper can be published as a crate at crates.io too (there are some abandoned third-party mediainfo crates there) but the way I did it is probably not ready to be published as it depends on files from repo or the official DLL package. I do not have experience publishing crates too.

@cjee21 cjee21 force-pushed the android-lib branch 2 times, most recently from 91d68da to 0604d92 Compare May 16, 2026 09:25
@cjee21
Copy link
Copy Markdown
Contributor Author

cjee21 commented May 16, 2026

I added an example app to test and demonstrate using the AAR with both the Kotlin interface and the native C/C++/CMake interface. Demo app written in Jetpack Compose.

Screenshot_20260516_230041 Screenshot_20260516_230046 Screenshot_20260516_230052

@cjee21 cjee21 force-pushed the android-lib branch 2 times, most recently from d86dc20 to 4c57f71 Compare May 16, 2026 15:12
@JeromeMartinez
Copy link
Copy Markdown
Member

I added an example app

Great, very appreciated.

@cjee21
Copy link
Copy Markdown
Contributor Author

cjee21 commented May 17, 2026

Now with libcurl support!

Screenshot_20260518_011707

@JeromeMartinez
Copy link
Copy Markdown
Member

Now with libcurl support!

Great!
Note: it would be also nice to have that with the Android UI (and elsewhere, yeah... Late on that).

@eeease
Copy link
Copy Markdown

eeease commented May 19, 2026

@cjee21 When I tried running gradlew.bat build :mediainfolib:assembleRelease, I got an exception trying to GET the required cURL dependency:
`Execution failed for task ':mediainfolib:checkReleaseAarMetadata'.

Could not resolve all files for configuration ':mediainfolib:releaseRuntimeClasspath'.
Could not resolve io.github.vvb2060.ndk:curl:8.18.0.
Required by:
project ':mediainfolib'

Could not resolve io.github.vvb2060.ndk:curl:8.18.0.
Could not get resource 'https://repo.maven.apache.org/maven2/io/github/vvb2060/ndk/curl/8.18.0/curl-8.18.0.pom'.
Could not GET 'https://repo.maven.apache.org/maven2/io/github/vvb2060/ndk/curl/8.18.0/curl-8.18.0.pom'.
Got SSL handshake exception during request. It might be caused by SSL misconfiguration
(certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target`

Any thoughts?

@cjee21
Copy link
Copy Markdown
Contributor Author

cjee21 commented May 19, 2026

Looks like your system fails (does not trust the security cert) to establish https connection to repo.maven.apache.org repository? It works fine here. The cert for that repo is from Let's Encrypt and looks fine. You can build without the last commit to exclude libcurl if you want to build without libcurl.

@eeease
Copy link
Copy Markdown

eeease commented May 19, 2026

Thanks, I'm actually _re_building from this commit because I would like to include libcurl.
It does look like a corp laptop cert issue. I'll see what I can do. Having libcurl would definitely be a bonus.

@eeease
Copy link
Copy Markdown

eeease commented May 19, 2026

Update: Yes, that was definitely a corp'd laptop VPN issue. I'm building now. Sorry for coming here so quickly with the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants