Closed Spiggie closed 6 years ago
Here's an update from my side: I'm testing on AVDs. It looks like this problem occurs only with API 26. An AVD with API 24 seems to run mostly fine (the errors occur also, but way less). I couldn't test API 25 because no bridges are found...
So: AVD API 24: ok AVD API 25: No bridges found AVD API 26: Errors
targetSdkVersion
and compileSdkVersion
are both set to 26. minSdkVersion
is 19.
Meanwhile your question is answered on the developer forum: https://developers.meethue.com/content/working-new-huesdk and doesnt look like a bug in the SDK. Please check back on the forum for further support.
I am getting the same error. My bridge is definitely in a singleton. From experimenting it seems to be the heartbeat frequency. If I set it to 20 seconds it does not happen. If I set it to 1 second it happens upon connection almost. I only get lights an scenes not the full config
Can you provide SDK logging ?
EDIT: opened up a new issue since this was closed an not reopend.
Just take your sample android app. Change the below to enable hertbeat.
private BridgeStateUpdatedCallback bridgeStateUpdatedCallback = new BridgeStateUpdatedCallback() {
@Override
public void onBridgeStateUpdated(Bridge bridge, BridgeStateUpdatedEvent bridgeStateUpdatedEvent) {
Log.i(TAG, "Bridge state updated event: " + bridgeStateUpdatedEvent);
switch (bridgeStateUpdatedEvent) {
case INITIALIZED:
// The bridge state was fully initialized for the first time.
// It is now safe to perform operations on the bridge state.
updateUI(UIState.Connected, "Connected!");
final BridgeConnection bridgeConnection = bridge.getBridgeConnection(BridgeConnectionType.LOCAL);
if (bridgeConnection == null) return;
final HeartbeatManager heartbeatManager = bridgeConnection.getHeartbeatManager();
if (heartbeatManager == null) return;
heartbeatManager.stopAllHeartbeats();
//
heartbeatManager.startHeartbeat(BridgeStateCacheType.LIGHTS_AND_GROUPS, 1000);
heartbeatManager.startHeartbeat(BridgeStateCacheType.SCENES, 1000);
break;
case LIGHTS_AND_GROUPS:
// At least one light was updated.
break;
default:
break;
}
}
};
It either breaks down and disconnects like the below
03-03 14:52:15.585 24576-24576/? I/art: Not late-enabling -Xcheck:jni (already on)
03-03 14:52:15.586 24576-24576/? W/art: Unexpected CPU variant for X86 using defaults: x86_64
03-03 14:52:15.659 24576-24576/com.philips.lighting.hue.demo.huequickstartapp I/HueSDK: JNI_HueSDK - JNI_OnLoad called
03-03 14:52:15.676 24576-24576/com.philips.lighting.hue.demo.huequickstartapp W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
03-03 14:52:15.756 24576-24576/com.philips.lighting.hue.demo.huequickstartapp I/HueQuickStartApp: Status: Connecting to bridge...
03-03 14:52:15.824 24576-24611/com.philips.lighting.hue.demo.huequickstartapp I/OpenGLRenderer: Initialized EGL, version 1.4
03-03 14:52:15.824 24576-24611/com.philips.lighting.hue.demo.huequickstartapp D/OpenGLRenderer: Swap behavior 1
03-03 14:52:15.824 24576-24611/com.philips.lighting.hue.demo.huequickstartapp W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
03-03 14:52:15.824 24576-24611/com.philips.lighting.hue.demo.huequickstartapp D/OpenGLRenderer: Swap behavior 0
03-03 14:52:15.832 24576-24591/com.philips.lighting.hue.demo.huequickstartapp I/HueQuickStartApp: Bridge state updated event: BRIDGE_CONFIG
03-03 14:52:15.838 24576-24616/com.philips.lighting.hue.demo.huequickstartapp I/HueQuickStartApp: Connection event: CONNECTED
03-03 14:52:15.846 24576-24611/com.philips.lighting.hue.demo.huequickstartapp D/EGL_emulation: eglCreateContext: 0x738bee5e5700: maj 3 min 1 rcv 4
03-03 14:52:15.887 24576-24611/com.philips.lighting.hue.demo.huequickstartapp D/EGL_emulation: eglMakeCurrent: 0x738bee5e5700: ver 3 1 (tinfo 0x738be46bbc40)
03-03 14:52:15.888 24576-24611/com.philips.lighting.hue.demo.huequickstartapp E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
03-03 14:52:15.888 24576-24611/com.philips.lighting.hue.demo.huequickstartapp E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
03-03 14:52:15.902 24576-24611/com.philips.lighting.hue.demo.huequickstartapp D/EGL_emulation: eglMakeCurrent: 0x738bee5e5700: ver 3 1 (tinfo 0x738be46bbc40)
03-03 14:52:16.054 24576-24622/com.philips.lighting.hue.demo.huequickstartapp I/HueQuickStartApp: Connection event: AUTHENTICATED
03-03 14:52:16.083 24576-24591/com.philips.lighting.hue.demo.huequickstartapp I/HueQuickStartApp: Bridge state updated event: FULL_CONFIG
03-03 14:52:16.102 24576-24591/com.philips.lighting.hue.demo.huequickstartapp I/HueQuickStartApp: Bridge state updated event: INITIALIZED
03-03 14:52:16.103 24576-24576/com.philips.lighting.hue.demo.huequickstartapp I/HueQuickStartApp: Status: Connected!
03-03 14:52:16.206 24576-24592/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: Retriever: invalid json retrieved from: http://QQQ.QQQ.QQQ.QQQ/api/QQQQQQQQQQQQQQQQQQQQQQQQQQ, resource path: /scenes
03-03 14:52:16.206 24576-24624/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: HeartbeatManager: perform_heartbeat: bridge state not updated, because the response was corrupt - Fatal error, disconnecting
03-03 14:52:16.206 24576-24624/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: BridgeConnection: Fatal disconnect - Bridge response corrupt, SDK cannot parse.
03-03 14:52:16.226 24576-24628/com.philips.lighting.hue.demo.huequickstartapp E/HueQuickStartApp: Connection error: SDK Error: code RESPONSE_CORRUPT, Bridge response corrupt, SDK cannot parse.
03-03 14:52:16.248 24576-24632/com.philips.lighting.hue.demo.huequickstartapp I/HueQuickStartApp: Connection event: DISCONNECTED
or gets errors every heartbeat:
03-03 15:00:52.841 24705-24705/? I/art: Not late-enabling -Xcheck:jni (already on)
03-03 15:00:52.842 24705-24705/? W/art: Unexpected CPU variant for X86 using defaults: x86_64
03-03 15:00:52.882 24705-24705/com.philips.lighting.hue.demo.huequickstartapp I/HueSDK: JNI_HueSDK - JNI_OnLoad called
03-03 15:00:52.894 24705-24705/com.philips.lighting.hue.demo.huequickstartapp W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
03-03 15:00:52.995 24705-24705/com.philips.lighting.hue.demo.huequickstartapp I/HueQuickStartApp: Status: Connecting to bridge...
03-03 15:00:53.060 24705-24742/com.philips.lighting.hue.demo.huequickstartapp I/OpenGLRenderer: Initialized EGL, version 1.4
03-03 15:00:53.060 24705-24742/com.philips.lighting.hue.demo.huequickstartapp D/OpenGLRenderer: Swap behavior 1
03-03 15:00:53.061 24705-24742/com.philips.lighting.hue.demo.huequickstartapp W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
03-03 15:00:53.061 24705-24742/com.philips.lighting.hue.demo.huequickstartapp D/OpenGLRenderer: Swap behavior 0
03-03 15:00:53.080 24705-24742/com.philips.lighting.hue.demo.huequickstartapp D/EGL_emulation: eglCreateContext: 0x738bee5e64c0: maj 3 min 1 rcv 4
03-03 15:00:53.134 24705-24742/com.philips.lighting.hue.demo.huequickstartapp D/EGL_emulation: eglMakeCurrent: 0x738bee5e64c0: ver 3 1 (tinfo 0x738bd4954a60)
03-03 15:00:53.135 24705-24742/com.philips.lighting.hue.demo.huequickstartapp E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
03-03 15:00:53.136 24705-24742/com.philips.lighting.hue.demo.huequickstartapp E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
03-03 15:00:53.148 24705-24742/com.philips.lighting.hue.demo.huequickstartapp D/EGL_emulation: eglMakeCurrent: 0x738bee5e64c0: ver 3 1 (tinfo 0x738bd4954a60)
03-03 15:00:57.651 24705-24721/com.philips.lighting.hue.demo.huequickstartapp I/HueQuickStartApp: Bridge state updated event: BRIDGE_CONFIG
03-03 15:00:57.657 24705-24749/com.philips.lighting.hue.demo.huequickstartapp I/HueQuickStartApp: Connection event: CONNECTED
03-03 15:00:57.882 24705-24753/com.philips.lighting.hue.demo.huequickstartapp I/HueQuickStartApp: Connection event: AUTHENTICATED
03-03 15:00:57.902 24705-24721/com.philips.lighting.hue.demo.huequickstartapp I/HueQuickStartApp: Bridge state updated event: FULL_CONFIG
03-03 15:00:57.920 24705-24721/com.philips.lighting.hue.demo.huequickstartapp I/HueQuickStartApp: Bridge state updated event: INITIALIZED
03-03 15:00:57.920 24705-24705/com.philips.lighting.hue.demo.huequickstartapp I/HueQuickStartApp: Status: Connected!
03-03 15:00:57.975 24705-24722/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: Retriever: invalid json retrieved from: http://QQQ.QQQ.QQQ.QQQ/api/QQQQQQQQQQQQQQQQQQQQQQQQQQ, resource path: /groups
03-03 15:00:57.982 24705-24754/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: LightAndGroupParser: groups node missing
03-03 15:00:57.982 24705-24754/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: HeartbeatManager: perform_heartbeat: bridge state not updated, because the retriever returned an error, cache type: BRIDGE_STATE_CACHE_TYPE_LIGHTS_AND_GROUPS, connection string: http://QQQ.QQQ.QQQ.QQQ/api/QQQQQQQQQQQQQQQQQQQQQQQQQQ
03-03 15:01:01.373 24705-24722/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: Retriever: invalid json retrieved from: http://QQQ.QQQ.QQQ.QQQ/api/QQQQQQQQQQQQQQQQQQQQQQQQQQ, resource path: /lights
03-03 15:01:01.397 24705-24754/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: LightAndGroupParser: lights node missing
03-03 15:01:01.398 24705-24754/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: HeartbeatManager: perform_heartbeat: bridge state not updated, because the retriever returned an error, cache type: BRIDGE_STATE_CACHE_TYPE_LIGHTS_AND_GROUPS, connection string: http://QQQ.QQQ.QQQ.QQQ/api/QQQQQQQQQQQQQQQQQQQQQQQQQQ
03-03 15:01:06.039 24705-24722/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: Retriever: invalid json retrieved from: http://QQQ.QQQ.QQQ.QQQ6/api/QQQQQQQQQQQQQQQQQQQQQQQQQQ, resource path: /groups
03-03 15:01:06.041 24705-24754/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: LightAndGroupParser: groups node missing
03-03 15:01:06.041 24705-24754/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: HeartbeatManager: perform_heartbeat: bridge state not updated, because the retriever returned an error, cache type: BRIDGE_STATE_CACHE_TYPE_LIGHTS_AND_GROUPS, connection string: http://QQQ.QQQ.QQQ.QQQ/api/QQQQQQQQQQQQQQQQQQQQQQQQQQ
Hey, I think I have an issue and I need help. I am developing in AndroidStudio and I am using the QuickStartApp. So far it is working. But as soon as I want to enable the hearbeats the SDK is firing errors after errors. So here's a quick overview of what I've done.
In the
bridgeStateUpdatedCallback.onBridgeStateUpdated
I called the methodstartHeartbeats()
in the INITIALIZED case. ThestartHeartbeats()
method looks like this:private void startHeartbeats() { if (bridge != null) { BridgeConnection bridgeConnection = bridge.getBridgeConnection(BridgeConnectionType.LOCAL); if (bridgeConnection != null) { heartbeatManager = bridgeConnection.getHeartbeatManager(); if (heartbeatManager != null) { Log.d(TAG, "Starting heartbeats..."); heartbeatManager.startHeartbeat(BridgeStateCacheType.FULL_CONFIG, 10000); heartbeatManager.startHeartbeat(BridgeStateCacheType.LIGHTS_AND_GROUPS, 1000); } } } }
The heartbeats are stopped in the overridden
onPause()
method.The heartbeats are working but giving me errors. I get these every time the callback would be invoked (every 10s for FULL_CONFIG and after 1s if a light has changed):
11-05 21:17:09.693 3903-4420/com.philips.lighting.hue.demo.huequickstartapp I/HueQuickStartApp: Bridge state updated event: FULL_CONFIG
11-05 21:17:09.693 3903-4420/com.philips.lighting.hue.demo.huequickstartapp D/HueQuickStartApp: BridgeStateUpdatedCallback.BridgeStateUpdatedEvent.FULL_CONFIG
11-05 21:17:10.194 3903-4421/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: Retriever: invalid json retrieved from: http://bridge-ip/api/bridge-user, resource path: /lights
11-05 21:17:10.209 3903-4421/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: Retriever: invalid json retrieved from: http://bridge-ip/api/bridge-user, resource path: /groups
11-05 21:17:10.209 3903-4446/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: LightAndGroupParser: lights node missing
11-05 21:17:10.209 3903-4446/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: LightAndGroupParser: groups node missing
11-05 21:17:10.209 3903-4446/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: HeartbeatManager: perform_heartbeat: bridge state not updated, because the retriever returned an error, cache type: BRIDGE_STATE_CACHE_TYPE_LIGHTS_AND_GROUPS, connection string: http://bridge-ip/api/bridge-user
If I visit the link in Chrome it shows me all data, including the lights and groups. I also checked the json in a json validator, everything is ok.
I also tried different bridges (one freshly bought) with the same result.
After a while the SDK disconnects:
11-05 21:17:30.028 3903-4446/com.philips.lighting.hue.demo.huequickstartapp E/HueSDK: BridgeConnection: Fatal disconnect - Bridge response corrupt, SDK cannot parse.
11-05 21:17:30.056 3903-4668/com.philips.lighting.hue.demo.huequickstartapp E/HueQuickStartApp: Connection error: SDK Error: code RESPONSE_CORRUPT, Bridge response corrupt, SDK cannot parse.
11-05 21:17:30.086 3903-4671/com.philips.lighting.hue.demo.huequickstartapp I/HueQuickStartApp: Connection event: DISCONNECTED
Any ideas?