hap-java / HAP-Java

Java implementation of the HomeKit Accessory Protocol
MIT License
152 stars 83 forks source link

When matching, "OSStatus 200500" error is returned #144

Open sercangoger opened 3 years ago

sercangoger commented 3 years ago

Hello, I started to run this existing library on an android application. But I have some problems. The first one works for android API 28 and above, this library does not work for lower versions. Second, I developed an application in API 28 version. I can show myself as bridge in IOS Homekit application. but When I match, enter the password and click the next button, I get an "OSStatus 200500" error.

andylintner commented 3 years ago

It's never worked on Android. There was a contribution in #116 to resolve this, but the contributor appears to have abandoned the effort.

XhosaS commented 2 years ago

I get an "OSStatus 200500" error too,I think this error is not related to Android

XhosaS commented 2 years ago

I solved this problem!

My device get "OSStatus 200500" because this exception:

W/i*.g*.h*.s*.i*.c*.Http*: Could not handle request
    javax.json.JsonException: Provider org.glassfish.json.JsonProviderImpl not found
        at javax.json.spi.JsonProvider.provider(JsonProvider.java:97)
        at javax.json.Json.createArrayBuilder(Json.java:257)
        at io.github.hapjava.server.impl.json.AccessoryController.listing(AccessoryController.java:31)
        at io.github.hapjava.server.impl.connections.HttpSession.handleAuthenticatedRequest(HttpSession.java:74)
        at io.github.hapjava.server.impl.connections.ConnectionImpl.doHandleRequest(ConnectionImpl.java:55)
        at io.github.hapjava.server.impl.connections.ConnectionImpl.handleRequest(ConnectionImpl.java:49)
        at io.github.hapjava.server.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:52)
        at io.github.hapjava.server.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:17)
        at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
        at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:56)
        at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:365)
        at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66)
        at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1044)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:764)

I check my project and find my gradle configuration is that:

implementation files('libs\\slf4j-android-1.6.1-RC1.jar')
    // hap-java
    implementation ('io.github.hap-java:hap:2.0.0') {
        exclude group:'org.glassfish', module: 'javax.json'
        exclude group:'org.zeromq', module: 'curve25519-java'
        exclude group:'org.slf4j', module: 'slf4j-api'
    }
    implementation "com.google.zxing:core:3.3.0"

fix the first exclude:

implementation files('libs\\slf4j-android-1.6.1-RC1.jar')
    // hap-java
    implementation ('io.github.hap-java:hap:2.0.0') {
        exclude group:'javax.json', module: 'javax.json-api'
        exclude group:'org.zeromq', module: 'curve25519-java'
        exclude group:'org.slf4j', module: 'slf4j-api'
    }
    implementation "com.google.zxing:core:3.3.0"

by the way, slf4j is not work good in Android,so this problem is too hard to find reason,util I find slf4j for android, so if we want run this project in Android, recommend replace slf4j.