sccn / labstreaminglayer

LabStreamingLayer super repository comprising submodules for LSL and associated apps.
Other
522 stars 157 forks source link

building for android fails #104

Open devriesewouter89 opened 1 year ago

devriesewouter89 commented 1 year ago

Hi All I'm trying to build LSL for android to be able to use it in a Unity VR app (android device). I'm assuming I need an .aar or .so file within my unity environment to be able to build a VR app for android.

I'm posting this in the 'main' repo as I have the issue in both liblsl-Android as well as liblsl-Java. I've tested this issue on multiple devices as well as Ubuntu 22.04 and Windows 10. When I try to build via Android studio as well as via command line gradle, I encounter the next message: com.intellij.openapi.externalSystem.model.ExternalSystemException (no error message) Which isn't really helpful :)

I've adapted my local.properties file so it targets: android SDK & Ndk (ndk version 21.0.6113669) cmake 3.22.1 java 11.0.16

Are there some prerequisites missing from the instructions to be able to build?

Am I correct assuming that I need the .aar or .so file to use from unity to an android device?

Sincerely Wouter

cboulay commented 1 year ago

I can't help you because I don't have an Android build environment setup and I don't have the bandwidth to maintain it.

Have you seen the following docs? Are you saying the instructions are no longer working? If so then maybe we can convince someone with a working Android build to look into it.

https://labstreaminglayer.readthedocs.io/dev/build_android.html

devriesewouter89 commented 1 year ago

Hi Chadwick thanks for the response (also on other subject). I've seen the documentation. The build android documentation is not working for me. On slack there was an other person with the same error, in channel 'users' at October 6, who based himself on the documentation. I'm not very familiar in the android environment, yet can't find anything useful on this error elsewhere. I think it could already help to diagnose if the problem persists if I can check with exact same setup of someone who has a working version (Unity version, Android SDK/Ndk , CMake version, JDK) as now I don't know where to look to debug.

devriesewouter89 commented 1 year ago

I can't help you because I don't have an Android build environment setup and I don't have the bandwidth to maintain it.

Have you seen the following docs? Are you saying the instructions are no longer working? If so then maybe we can convince someone with a working Android build to look into it.

https://labstreaminglayer.readthedocs.io/dev/build_android.html

I've poked around a bit more. On Ubuntu 22.04 to be specific. I've tested multiple versions of Android Sdk ndk (all 21.x.x versions) and Cmake 3.18 as well as 3.22

The error I now get is:

* What went wrong:
Could not determine the dependencies of task ':generateJsonModelRelease'.
> Invalid revision: 3.18.1-g262b901

This is with a clean clone of the labstreamlayer repo with liblsl-Java submodule. my local.properties are:

ndk.dir=/home/scoot/Android/Sdk/ndk/21.0.6113669
android.ndkVersion=21.0.6113669
sdk.dir=/home/scoot/Android/Sdk
cmake.dir=/home/scoot/Android/Sdk/cmake/3.18.1

Is there someone on the labstreamlayer project who could help with checking if the:

I'm aware that maintaining is a drag so I understand it if there's no room now to look into it. If so, then I have to look elsewhere and perhaps just implement a websocket.

Sincerely Wouter

devriesewouter89 commented 1 year ago

I can't help you because I don't have an Android build environment setup and I don't have the bandwidth to maintain it.

Have you seen the following docs? Are you saying the instructions are no longer working? If so then maybe we can convince someone with a working Android build to look into it.

https://labstreaminglayer.readthedocs.io/dev/build_android.html

Just gave another option a try: github actions. I get the same error about the invalid revision there: https://github.com/luca-arts/android_-ci_test (Note, this is a quick and dirty setup, with copying of the specific repos. I'll remove this in near future, but could perhaps help finding the issue?)

Sincerely Wouter

Dazzle995 commented 1 year ago

Hi everyone, I was confronted with the same problem and found a solution for me.

I had to change the android gradle dependecy in liblsl-Java/build.gradle from classpath 'com.android.tools.build:gradle:4.0.1' to classpath 'com.android.tools.build:gradle:8.0.0-alpha01'.

I was going through the dependency chain from Unity to Android Sdk to cmake and finally to java and gradle. Depending on the versions other people are using, a different version might be necessary.

Hopefully this is useful for people struggling with this :)