Issues integrating with Android - any advice would be greatly appreciated

159 views
Skip to first unread message

Johan Jarvi

unread,
Feb 26, 2021, 4:10:42 AM2/26/21
to gstreamer-java
Hi everyone,

let me start by thanking anyone for reading this massive question - also any help at all would be greatly appreciated.
----
firstly - system information:
Ubuntu 18.04
Android Studio Version 4.1.2
NDK version 21 (also tested with NDK version 23)
Target API 21 (Installed up to SDK 30)
Brand new project created today
----
Dependencies:
implementation 'net.java.dev.jna:jna:4.4.0@aar'
gst1-java-core.1.4.0.jar

Now to the problem:
Basically after having read "but should work on any OS with Java, JNA and GStreamer support" on the Github README I decided to try and integrate the gst1-java-core into an Android application.


And the problem I am encountering is the following error:
https://gist.github.com/JohanJarvi/a01b7f31ebefd2aee5cda09676f2873d

When attempting to add this line:
Gst.init()
To my MainActivity.

This is a fresh project setup using NDK support in Android studio, the only line of code I have added is the Gst.init() including the import:
import org.freedesktop.gstreamer.Gst;

All which appears to be imported correctly as I can browns the files and code completion works correctly.

I attempted to setup the environment variable as suggested by Gstreamer themselves in their installation guide (https://gstreamer.freedesktop.org/documentation/installing/for-android-development.html?gi-language=c); namely:
GSTREAMER_ROOT_ANDROID=/home/USER/Android/gstreamer

I have added this as an environment variable in both my ~/.profile, ~/.bashrc and also to both local.properties and gradle.properties files inside my project.

The folder that these env variables point to then contains the unzipped binaries as recommended when installing for Android. However, this alone does not make the code compile and still complains about this missing library.

I have run the java examples available including the "swing" example and that works just fine (https://github.com/gstreamer-java/gst1-java-examples/tree/master/SwingPlayer)

So it does not appear to be a system level problem but more so an issue in integrating gstreamer installation inside of Android.

If anyone can help me resolve this issue I would be more than happy to create documentation for how to go about getting Gstreamer working in Android using your gst1-java-core wrapper together with JNA.

Again, any help is greatly greatly appreciated.

Neil C Smith

unread,
Feb 26, 2021, 6:36:00 AM2/26/21
to gstream...@googlegroups.com
Hi,

On Fri, 26 Feb 2021 at 09:10, Johan Jarvi <jo...@australiandroid.com.au> wrote:
> Dependencies:
> implementation 'net.java.dev.jna:jna:4.4.0@aar'
> gst1-java-core.1.4.0.jar
>
> Now to the problem:
> Basically after having read "but should work on any OS with Java, JNA and GStreamer support" on the Github README I decided to try and integrate the gst1-java-core into an Android application.

I have no idea whether anyone is using gst1-java-core with Android. I
know in the past some people had tried with the old GStreamer 0.10
Java bindings. It's certainly not an OS that is officially supported,
tested for, nor to be frank one that meets my definition of an OS with
Java support!

It would be great if it did work, but unless anyone else on the list
has experience with doing this, you might be doing a lot of exploring
on your own here.

Incidentally, the library requires at least JNA 5.2.0, and really best
to use the latest.

> I attempted to setup the environment variable as suggested by Gstreamer themselves in their installation guide (https://gstreamer.freedesktop.org/documentation/installing/for-android-development.html?gi-language=c); namely:
> GSTREAMER_ROOT_ANDROID=/home/USER/Android/gstreamer

I'm not sure which sections of the upstream documentation will be
useful here - obviously there are other ways of using GStreamer on
Android. The key initial thing will be making sure all of the
GStreamer libraries are in the native path so that JNA can find them.

Best wishes,

Neil

--
Neil C Smith
Codelerity Ltd.
www.codelerity.com

Codelerity Ltd. is a company registered in England and Wales
Registered company number : 12063669
Registered office address : Office 4 219 Kensington High Street,
Kensington, London, England, W8 6BD

Johan Jarvi

unread,
Feb 28, 2021, 8:56:52 PM2/28/21
to gstreamer-java
Thanks for taking your time to answer and yeah I suppose you are correct in that Android doesn't exactly have Java support just because it is built with Java (mostly). 

It would be excellent if it could work and in the future perhaps I will investigate a way to make it work in perhaps open a pull request on your Github if I can get something going.

Unfortunately, as for right now as I was doing this as part of my day job I have reverted back to native C implementations for Gstreamer on Android like the Gstreamer tutorials suggests.

Thanks again.

Reply all
Reply to author
Forward
0 new messages