Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot receive OSC on android API 32 #75

Open
lillithkt opened this issue Sep 20, 2024 · 7 comments
Open

Cannot receive OSC on android API 32 #75

lillithkt opened this issue Sep 20, 2024 · 7 comments

Comments

@lillithkt
Copy link

java.lang.NoSuchMethodError: No virtual method getDefinedPackage(Ljava/lang/String;)Ljava/lang/Package; in class Ljava/lang/ClassLoader; or its super classes (declaration of 'java.lang.ClassLoader' appears in /apex/com.android.art/javalib/core-oj.jar)
                                                                                                    	at com.illposed.osc.LibraryInfo.<clinit>(LibraryInfo.java:46)
                                                                                                    	at com.illposed.osc.LibraryInfo.hasStandardProtocolFamily(LibraryInfo.java:283)
                                                                                                    	at com.illposed.osc.transport.udp.UDPTransport.<init>(UDPTransport.java:61)
                                                                                                    	at com.illposed.osc.transport.OSCPort.<init>(OSCPort.java:40)
                                                                                                    	at com.illposed.osc.transport.OSCPortIn.<init>(OSCPortIn.java:108)
                                                                                                    	at com.illposed.osc.transport.OSCPortIn.<init>(OSCPortIn.java:123)
                                                                                                    	at com.illposed.osc.transport.OSCPortIn.<init>(OSCPortIn.java:132)
                                                                                                    	at com.illposed.osc.transport.OSCPortIn.<init>(OSCPortIn.java:145)
                                                                                                    	at com.illposed.osc.transport.OSCPortIn.<init>(OSCPortIn.java:160)
                                                                                                    	at com.illposed.osc.transport.OSCPortIn.<init>(OSCPortIn.java:170)```


here is the code it is running in: ```kt
package gay.lilyy.lilypad.core.osc

import com.illposed.osc.MessageSelector
import com.illposed.osc.OSCMessageEvent
import com.illposed.osc.OSCMessageListener
import com.illposed.osc.transport.OSCPortIn
import gay.lilyy.lilypad.core.modules.CoreModules
import gay.lilyy.lilypad.core.modules.Modules
import io.github.aakira.napier.Napier

object OSCReceiver {
    var receiver: OSCPortIn? = null

    val listeners: MutableList<Pair<MessageSelector, OSCMessageListener>> = mutableListOf()
    fun updateAddress() {
        if (CoreModules.Core.config!!.logs.debug) Napier.d("Updating OSC receiver address to ${CoreModules.Core.config!!.listen}")
        receiver?.close()
        receiver = OSCPortIn(CoreModules.Core.config!!.listen)
        for ((selector, listener) in listeners) {
            receiver?.dispatcher?.addListener(selector, listener)
        }
        receiver?.startListening()
    }

    init {
        updateAddress()
        addListener({ true }) {
            if (CoreModules.Core.config!!.logs.incomingData) Napier.d("Received message: ${it.message.address} ${it.message.arguments.joinToString()}")
        }
    }


    fun addListener(matches: (OSCMessageEvent) -> Boolean, listener: OSCMessageListener) {
        val selector = object : MessageSelector {
            override fun isInfoRequired(): Boolean = false

            override fun matches(event: OSCMessageEvent): Boolean {
                return matches(event)
            }
        }
        listeners += selector to listener
        receiver?.dispatcher?.addListener(selector, listener)
    }
}

i am attempting to run this on a Meta Quest 3

@lillithkt
Copy link
Author

lillithkt commented Sep 20, 2024

temporary fix is downgrading to 0.8, as the problem code was introduced in 2cbbc43

@hannesa2
Copy link
Contributor

hannesa2 commented Sep 23, 2024

@ImLvna
I'm searching for an Android sample to receive messages, do you have one ?

@lillithkt
Copy link
Author

lillithkt commented Sep 25, 2024

Hey there! The project i am using this in is ImLvna/Lilypad. To recreate it, bump osc in the versions category of ./gradle/libs.versions.toml back up to 0.9, and possibly remove the backported java.awt.color fix from here found in ./lilypadApp/src/commonMain/kotlin/gay/lilyy/lilypad/core/osc/OSCSender.kt

edit: ohh, i misunderstood. if you are just trying to recieve messages and not looking to fix the bug, you don't need to make any changes to my code. you will need to use javaosc 0.8 as 0.9 is broken on android, and for sending messages you will need to use this fix for avoiding java.awt.color. feel free to take my code. It is unlicensed as i have not set that up yet, but do whatever you need with it

@hoijui
Copy link
Owner

hoijui commented Dec 30, 2024

It would be nice if someone developing on Android could fix this. I don't and I won't setup Android dev stuff.

@cormacstewart14
Copy link

@hoijui @lillithkt it looks like you forked this project in ImLvna/Lilypad and fixed it there. Is there any way you could commit your fix to this project as well? It seems there are a number of people facing the same issues trying to run on Android.

@hannesa2
Copy link
Contributor

@cormacstewart14 There all my pull request where closed unmerged. That guy wants to solve it by himself, that's why I see it as a waste of time to continue there.

Image

@cormacstewart14
Copy link

@hannesa2 that is too bad. This project would be a huge help for us.

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

No branches or pull requests

4 participants