I'm seeing different versions of the GrowthBook do...
# ask-questions
d
I'm seeing different versions of the GrowthBook documentation for Kotlin (back end, not Android), and I'm struggling to get my project off the ground. When I click on the SDK I set up, I see this sample:
Copy code
GBContext context = GBContext.builder()
    .featuresJson(featuresJson)
    .attributesJson(userAttributesObj.toString()) // Optional
    .encryptionKey("****") // You may want to store this in an environment variable
    .trackingCallback(trackingCallback)
    .build();
GrowthBook growthBook = new GrowthBook(context);
But when I check https://github.com/growthbook/growthbook-kotlin , I see this:
Copy code
var sdkInstance: GrowthBookSDK = GBSDKBuilderJAVA(apiKey = <API_KEY>,
    hostURL = <GrowthBook_URL>,
    attributes = <Hashmap>,
    features = <Hashmap>,
    trackingCallback = { gbExperiment, gbExperimentResult ->

}).initialize()
The sample from
<http://app.growthbook.io|app.growthbook.io>
uses
GBContext
and has no API key, while the github sample uses
GBSDKBuilderJAVA
and requires an API key. Which is correct?
m
Hi @dazzling-garden-98992, thank you for the feedback. Please use the docs from GitHub repo, we will update soon docs on the website.
šŸ‘€ 1
d
@most-spoon-61816 is the API Key only required for having write access to features from the SDK? If I only want to read features, what should I be using?
After looking at the samples, I'm not sure which dependency I should be using:
Copy code
maven {
        url = uri("<https://jitpack.io>")
    }
com.github.growthbook:growthbook-sdk-java:0.3.0
Or
io.growthbook.sdk:GrowthBook-jvm:1.1.27
Which one is it for a server side Kotlin app? @fresh-football-47124 @helpful-application-7107
b
hi @dazzling-garden-98992, the example in your first message is for this dependency:
Copy code
maven {
        url = uri("<https://jitpack.io>")
    }
com.github.growthbook:growthbook-sdk-java:0.3.0
it can be used both in java and in kotlin. the growthbook-kotlin project is android only and would not be compatible. ā€¢ here are the docs for the java SDK: https://docs.growthbook.io/lib/java ā€“ at the bottom there are some examples (java spring, kotlin with ktor) ā€¢ here's the repository: https://github.com/growthbook/growthbook-sdk-java please note, the latest version of the java SDK is now 0.5.0. you may want to choose version 0.4.0 and up if you'd like networking support.
šŸ™ 1
šŸ™Œ 1
d
this did it for me, thanks!
šŸ™Œ 1