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

Callbacks are not executing on client.on(SplitEvent.SDK_READY) #544

Open
gastsail opened this issue Oct 6, 2023 · 4 comments
Open

Callbacks are not executing on client.on(SplitEvent.SDK_READY) #544

gastsail opened this issue Oct 6, 2023 · 4 comments

Comments

@gastsail
Copy link

gastsail commented Oct 6, 2023

Platform: Android

I have followed the documentation and used everything stated there, created my SDK API Key for client-side inside an Environment as below

Screenshot 2023-10-06 at 11 35 29

I have hidden organization details.

But after adding everything just to test on my MainActivity

        val sdkKey = "my-api-key-here"
        val config: SplitClientConfig = SplitClientConfig.builder().build()
        val matchingKey = "key"
        val key = Key(matchingKey)
        val splitFactory: SplitFactory =
            SplitFactoryBuilder.build(sdkKey, key, config, applicationContext)
        val client: SplitClient = splitFactory.client()
        
        client.on(SplitEvent.SDK_READY, object : SplitEventTask() {
            override fun onPostExecution(client: SplitClient) {
                // Execute background logic here
                when (client.getTreatment("my_feature_flag")) {
                    "on" -> {
                        // insert code here to show on treatment
                        Log.d("SPLIT", "onPostExecution: ON")
                    }
                    "off" -> {
                        // insert code here to show off treatment
                        Log.d("SPLIT", "onPostExecution: OFF")
                    }
                    else -> {
                        // insert your control treatment code here
                        Log.d("SPLIT", "onPostExecution: ELSE")
                    }
                }
            }
            override fun onPostExecutionView(client: SplitClient) {
                // Execute main thread logic here
                when (client.getTreatment("ncuenta_version")) {
                    "on" -> {
                        // insert code here to show on treatment
                        Log.d("SPLIT", "onPostExecutionView: ON")
                    }
                    "off" -> {
                        // insert code here to show off treatment
                        Log.d("SPLIT", "onPostExecutionView: OFF")
                    }
                    else -> {
                        // insert your control treatment code here
                        Log.d("SPLIT", "onPostExecutionView: ELSE")
                    }
                }
            }
        })

Nothing returns in the logs, I have already created the feature flag and everything, granted INTERNET access into the manifest, IDK what is happening, it should work

implementation("io.split.client:android-client:3.3.0")

compileSdk = 34

I'm only receiving

Screenshot 2023-10-06 at 11 38 41

Also added

val config: SplitClientConfig = SplitClientConfig.builder().impressionsMode(ImpressionsMode.DEBUG).build()

but cannot see anything in the console

I have also followed the demo app here

https://github.com/Split-Community/Split-SDKs-Examples/blob/main/android-sdk/UI_App/app/src/main/java/com/example/example_app/ui_app/SplitSDK.java

but no success

@agustinona
Copy link

Hi @gastsail in order to check if the SDK is running into any issues while initializing could you enable the SDK's debug logging (see: https://help.split.io/hc/en-us/articles/360020343291-Android-SDK#logging) and share the logs here?

@gastsail
Copy link
Author

@agustinona I have tried again and is not triggering any callback even if I put the callback right after the splitFactory.client()

@gastsail
Copy link
Author

The error log shows this

W  Method java.lang.Object androidx.compose.runtime.snapshots.SnapshotStateMap.mutate(kotlin.jvm.functions.Function1) failed lock verification and will run slower.
                                                                                                   Common causes for lock verification issues are non-optimized dex code
                                                                                                   and incorrect proguard optimizations.
2023-11-01 14:18:53.109 24537-24537 ample.splittest         com.example.splittest                W  Method void androidx.compose.runtime.snapshots.SnapshotStateMap.update(kotlin.jvm.functions.Function1) failed lock verification and will run slower.
2023-11-01 14:18:53.109 24537-24537 ample.splittest         com.example.splittest                W  Method boolean androidx.compose.runtime.snapshots.SnapshotStateMap.removeIf$runtime_release(kotlin.jvm.functions.Function1) failed lock verification and will run slower.
2023-11-01 14:18:53.136 24537-24537 ample.splittest         com.example.splittest                W  Method boolean androidx.compose.runtime.snapshots.SnapshotStateList.conditionalUpdate(kotlin.jvm.functions.Function1) failed lock verification and will run slower.
2023-11-01 14:18:53.136 24537-24537 ample.splittest         com.example.splittest                W  Method java.lang.Object androidx.compose.runtime.snapshots.SnapshotStateList.mutate(kotlin.jvm.functions.Function1) failed lock verification and will run slower.
2023-11-01 14:18:53.136 24537-24537 ample.splittest         com.example.splittest                W  Method void androidx.compose.runtime.snapshots.SnapshotStateList.update(kotlin.jvm.functions.Function1) failed lock verification and will run slower.
2023-11-01 14:18:53.180 24537-24580 SplitSDK                com.example.splittest                E  Error while executing my segments sync task: Network error while retrieving my segments: Error while sending data to https://sdk.split.io/api/mySegments/37f86cb0-6382-11ee-bcc4-229fff831ab4: HttpException: Something happened while retrieving data: Chain validation failed
2023-11-01 14:18:53.180 24537-24589 SplitSDK                com.example.splittest                E  Error while executing splits sync/update task: Network error while fetching feature flagsError while sending data to https://sdk.split.io/api/splitChanges: HttpException: Something happened while retrieving data: Chain validation failed
2023-11-01 14:18:53.301 24537-24591 ProfileInstaller        com.example.splittest                D  Installing profile for com.example.splittest
2023-11-01 14:18:54.182 24537-24572 TrafficStats            com.example.splittest                D  tagSocket(105) with statsTag=0xffffffff, statsUid=-1
2023-11-01 14:18:54.182 24537-24589 TrafficStats            com.example.splittest                D  tagSocket(104) with statsTag=0xffffffff, statsUid=-1
2023-11-01 14:18:54.308 24537-24572 SplitSDK                com.example.splittest                E  Error while executing my segments sync task: Network error while retrieving my segments: Error while sending data to https://sdk.split.io/api/mySegments/37f86cb0-6382-11ee-bcc4-229fff831ab4: HttpException: Something happened while retrieving data: Chain validation failed
2023-11-01 14:18:54.308 24537-24589 SplitSDK                com.example.splittest                E  Error while executing splits sync/update task: Network error while fetching feature flagsError while sending data to https://sdk.split.io/api/splitChanges: HttpException: Something happened while retrieving data: Chain validation failed
2023-11-01 14:18:56.316 24537-24589 TrafficStats            com.example.splittest                D  tagSocket(104) with statsTag=0xffffffff, statsUid=-1
2023-11-01 14:18:56.319 24537-24572 TrafficStats            com.example.splittest                D  tagSocket(105) with statsTag=0xffffffff, statsUid=-1
2023-11-01 14:18:56.551 24537-24572 SplitSDK                com.example.splittest                E  Error while executing my segments sync task: Network error while retrieving my segments: Error while sending data to https://sdk.split.io/api/mySegments/37f86cb0-6382-11ee-bcc4-229fff831ab4: HttpException: Something happened while retrieving data: Chain validation failed
2023-11-01 14:18:56.551 24537-24589 SplitSDK                com.example.splittest                E  Error while executing splits sync/update task: Network error while fetching feature flagsError while sending data to https://sdk.split.io/api/splitChanges: HttpException: Something happened while retrieving data: Chain validation failed
2023-11-01 14:18:58.084 24537-24553 System                  com.example.splittest                W  A resource failed to call close. 
2023-11-01 14:18:58.106 24537-24598 TrafficStats            com.example.splittest                D  tagSocket(5) with statsTag=0xffffffff, statsUid=-1
2023-11-01 14:19:00.555 24537-24571 TrafficStats            com.example.splittest                D  tagSocket(74) with statsTag=0xffffffff, statsUid=-1
2023-11-01 14:19:00.555 24537-24589 TrafficStats            com.example.splittest                D  tagSocket(103) with statsTag=0xffffffff, statsUid=-1
2023-11-01 14:19:00.648 24537-24571 SplitSDK                com.example.splittest                E  Error while executing my segments sync task: Network error while retrieving my segments: Error while sending data to https://sdk.split.io/api/mySegments/37f86cb0-6382-11ee-bcc4-229fff831ab4: HttpException: Something happened while retrieving data: Chain validation failed
2023-11-01 14:19:01.655 24537-24589 SplitSDK                com.example.splittest                E  Error while executing splits sync/update task: Network error while fetching feature flagsError while sending data to https://sdk.split.io/api/splitChanges: HttpException: Something happened while retrieving data: Chain validation failed
2023-11-01 14:19:08.708 24537-24580 TrafficStats            com.example.splittest                D  tagSocket(60) with statsTag=0xffffffff, statsUid=-1
2023-11-01 14:19:09.067 24537-24580 SplitSDK                com.example.splittest                E  Error while executing my segments sync task: Network error while retrieving my segments: Error while sending data to https://sdk.split.io/api/mySegments/37f86cb0-6382-11ee-bcc4-229fff831ab4: HttpException: Something happened while retrieving data: Chain validation failed
2023-11-01 14:19:09.661 24537-24589 TrafficStats            com.example.splittest                D  tagSocket(60) with statsTag=0xffffffff, statsUid=-1
2023-11-01 14:19:09.924 24537-24589 SplitSDK                com.example.splittest                E  Error while executing splits sync/update task: Network error while fetching feature flagsError while sending data to https://sdk.split.io/api/splitChanges: HttpException: Something happened while retrieving data: Chain validation failed
2023-11-01 14:19:25.078 24537-24572 TrafficStats            com.example.splittest                D  tagSocket(60) with statsTag=0xffffffff, statsUid=-1
2023-11-01 14:19:25.185 24537-24572 SplitSDK                com.example.splittest                E  Error while executing my segments sync task: Network error while retrieving my segments: Error while sending data to https://sdk.split.io/api/mySegments/37f86cb0-6382-11ee-bcc4-229fff831ab4: HttpException: Something happened while retrieving data: Chain validation failed
2023-11-01 14:19:25.926 24537-24589 TrafficStats            com.example.splittest                D  tagSocket(60) with statsTag=0xffffffff, statsUid=-1
2023-11-01 14:19:26.053 24537-24589 SplitSDK                com.example.splittest                E  Error while executing splits sync/update task: Network error while fetching feature flagsError while sending data to https://sdk.split.io/api/splitChanges: HttpException: Something happened while retrieving data: Chain validation failed
2023-11-01 14:19:57.201 24537-24572 TrafficStats            com.example.splittest                D  tagSocket(60) with statsTag=0xffffffff, statsUid=-1
2023-11-01 14:19:57.344 24537-24572 SplitSDK                com.example.splittest                E  Error while executing my segments sync task: Network error while retrieving my segments: Error while sending data to https://sdk.split.io/api/mySegments/37f86cb0-6382-11ee-bcc4-229fff831ab4: HttpException: Something happened while retrieving data: Chain validation failed
2023-11-01 14:19:58.057 24537-24589 TrafficStats            com.example.splittest                D  tagSocket(60) with statsTag=0xffffffff, statsUid=-1
2023-11-01 14:19:58.164 24537-24589 SplitSDK                com.example.splittest                E  Error while executing splits sync/update task: Network error while fetching feature flagsError while sending data to https://sdk.split.io/api/splitChanges: HttpException: Something happened while retrieving data: Chain validation failed
2023-11-01 14:19:59.109 24537-24598 TrafficStats            com.example.splittest                D  tagSocket(60) with statsTag=0xffffffff, statsUid=-1
2023-11-01 14:19:59.215 24537-24598 SplitSDK                com.example.splittest                E  An unexpected error has occurred while receiving stream events from:  : HttpException: Something happened while retrieving data: Chain validation failed

@agustinona
Copy link

@gastsail In this case it seems the SDK is unable to establish a connection to Split's CDN due to a SSL handshake error:
2023-11-01 14:18:53.180 24537-24589 SplitSDK com.example.splittest E Error while executing splits sync/update task: Network error while fetching feature flagsError while sending data to https://sdk.split.io/api/splitChanges: HttpException: Something happened while retrieving data: Chain validation failed
Hence the SDK will not become ready and the callback will not be executed.

Is this happening in an emulator? Could you check is you are running into the issue described here? https://help.split.io/hc/en-us/articles/360042140631-HTTP-Exception-Chain-validation-failed

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

No branches or pull requests

2 participants