This repository was archived by the owner on Oct 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
This repository was archived by the owner on Oct 29, 2024. It is now read-only.
Android: Error: Cannot convert argument of type class com.launchdarkly.android.ConnectionInformationState #59
Copy link
Copy link
Closed
Description
Describe the bug
Calling .getConnectionInformation() method is throwing error on Android.
To reproduce
/* eslint-disable react-native/no-inline-styles */
import React, {useEffect, useState} from 'react';
import {SafeAreaView, View, Text} from 'react-native';
import LDClient from 'launchdarkly-react-native-client-sdk';
const client = new LDClient();
const clientConfig = {
mobileKey: 'MOBILE_KEY',
stream: true,
offline: false,
};
const userConfig = {key: 'user123'};
const App = () => {
const [allFlags, setAllFlags] = useState(false);
const [connInfo, setConnInfo] = useState(false);
const [backgroundColor, setBackgroundColor] = useState('white');
const [err, setError] = useState(null);
useEffect(() => {
(async () => {
try {
await client.configure(clientConfig, userConfig);
const bgColor = await client.stringVariation(
'backgroundColor',
'yellow',
);
setBackgroundColor(bgColor);
const flags = await client.allFlags();
setAllFlags(flags);
const info = await client.getConnectionInformation();
setConnInfo(info);
} catch (error) {
console.log(error);
setError(error.message);
}
})();
return () => {
client.close();
};
}, []);
return (
<View style={{flex: 1}}>
<View style={{flex: 1}}>
<SafeAreaView style={{flex: 1, backgroundColor: 'tomato'}}>
<Text style={{fontSize: 20}}>{connInfo}</Text>
<Text style={{fontSize: 20}}>{err}</Text>
</SafeAreaView>
<SafeAreaView style={{flex: 1, backgroundColor}}>
<Text
style={{
fontSize: 20,
backgroundColor: 'rgba(255,255,255,0.3)',
}}>
{JSON.stringify(allFlags, null, 2)}
</Text>
</SafeAreaView>
</View>
</View>
);
};
export default App;Expected behavior
Calling .getConnectionInformation() method should return meaningful error.
Logs
Error: Cannot convert argument of type class com.launchdarkly.android.ConnectionInformationState
at Object.promiseMethodWrapper [as getConnectionInformation] (NativeModules.js:103)
at LDClient.getConnectionInformation (index.js:257)
at _callee$ (App.js:35)
at tryCatch (runtime.js:63)
at Generator.invoke [as _invoke] (runtime.js:293)
at Generator.next (runtime.js:118)
at tryCatch (runtime.js:63)
at invoke (runtime.js:154)
at runtime.js:164
at tryCallOne (core.js:37)
SDK version
"launchdarkly-react-native-client-sdk": "^3.2.1"
Language version, developer tools
System:
OS: macOS 10.15.7
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 4.16 GB / 32.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.18.3 - ~/.nvm/versions/node/v12.18.3/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.14.6 - ~/.nvm/versions/node/v12.18.3/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
Android SDK: Not Found
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6200805
Xcode: 12.0.1/12A7300 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_232 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.3 => 0.63.3
react-native-macos: Not Found
Additional context
Running it on a physical device Pixel 3a with Android 10.
Metadata
Metadata
Assignees
Labels
No labels