Follow the installation instructions below for your platform and language.
The C# SDK is distributed through [NuGet](🔗). To install, run the command `
Install-Package Optimizely.SDK` in the <a href="https://docs.microsoft.com/en-us/nuget/tools/package-manager-console" target="_blank">Package Manager Console</a>.
The full source code is at <https://github.com/optimizely/csharp-sdk>.
The Java SDK is distributed through Bintray. The `
core-api` and `
httpclient` Bintray packages are [optimizely-sdk-core-api](🔗) and [optimizely-sdk-httpclient](🔗), respectively. You can find repository information and also instructions on how to install the dependencies on Bintray. Gradle repository and dependency configurations are shown on the right. The SDK is compatible with Java 1.6 and above.
core-api` requires `
org.slf4j:slf4j-api:1.7.16` and a supported JSON parser. We currently integrate with these parsers (listed in their selection order priority):
If more than one of these parsers are available at runtime, the `
core-api` chooses one for use per the selection order priority. If none of these packages are already provided in your project's classpath, you must add one.
core-httpclient-impl` requires `
org.apache.httpcomponents:httpclient:4.5.2` and provides an asynchronous event dispatcher that is described in [Configure the event dispatcher](🔗). This library isn't required and you may provide a custom `
EventHandler` implementation that uses a different networking stack.
The full source code is at <https://github.com/optimizely/java-sdk>.
We also distribute a prebuilt UMD bundle of the SDK, which may be helpful if you're prototyping in a browser. This is immediately usable with code like this:
The full source code is available on [GitHub](🔗).
Our PHP SDK is available through [Composer](🔗). To install, use `
composer require optimizely/optimizely-sdk` or add `
optimizely/optimizely-sdk` in the `
require` section of your `
The SDK requires PHP 5.5+.
The full source code is at <https://github.com/optimizely/php-sdk>.
The Python SDK is distributed through [PyPi](🔗). To install, use `
pip install optimizely-sdk` or add `
optmizely-sdk` your `
The full source code is at <https://github.com/optimizely/python-sdk>.
The gem for the Ruby SDK is distributed through [RubyGems](🔗). To install, use `
gem install optimizely-sdk` or bundler to install the gem `
The full source code is at <https://github.com/optimizely/ruby-sdk>.
The Android SDK packages are available on Jcenter:
[android-sdk](🔗) Includes all modules.
[datafile-handler](🔗) – Datafile download, caching and background services.
[event-handler](🔗) – Dispatches decision and track events to Optimizely.
[user-profile](🔗) – Makes bucketing persistent.
[shared](🔗) – Shared code between all modules.
android-sdk` module transitively depends on the `
user-profile`, and `
shared` modules. It also includes the latest version of gson and slf4j logger. Gradle can be used to exclude any dependency if you want to replace one with another version or implementation.
To add the `
android-sdk` and all modules to your project, include this line in your app's `
build.gradle` in the `
To exclude the default implementation of parser and slf4j, include this code:
Access the [android-sdk](🔗) repository on Bintray to determine the latest version. Note that you should be pinning your dependency to a major or minor version of the SDK to prevent breaking changes from major version upgrades from affecting your build.
Also check out the [test-app](🔗) in the SDK repository.
The full source code is at <https://github.com/optimizely/android-sdk>.
## iOS and tvOS
Our iOS and tvOS SDKs are available for distribution through CocoaPods, Carthage, or manual installation. You can use these SDKs with apps written in Objective C and Swift.
iOS 8.0+ or tvOS 9.0+
In the instructions below, `
<platform>` is used to represent the platform on which you are building your app. Currently, we support iOS and tvOS platforms. You should be pinning your dependency to a major or minor of the SDK to prevent breaking changes from major version upgrades from affecting your build.
Add this line to the Podfile:
Alternatively, if you are developing on tvOS, use:
Make sure `
use_frameworks!` is also included in the Podfile:
Run the command:
For more installation information, see the [Cocoapods Getting Started Guide](🔗).
Add this line to the _Cartfile_:
Run the command:
Link the frameworks to your project. Go to your project target's **Link Binary With Libraries** and drag over these frameworks from the _Carthage/Build/<platform>_ folder:
To ensure that proper bitcode-related files and dSYMs are copied when archiving your app, you must install a Carthage build script: a. Add a new **Run Script** phase in your target's **Build Phase**. b. Include this line in the script area:
<pre> $(SRCROOT)/Carthage/Build/<platform>/OptimizelySDKCore.framework $(SRCROOT)/Carthage/Build/<platform>/OptimizelySDKDatafileManager.framework $(SRCROOT)/Carthage/Build/<platform>/OptimizelySDKEventDispatcher.framework $(SRCROOT)/Carthage/Build/<platform>/OptimizelySDKShared.framework $(SRCROOT)/Carthage/Build/<platform>/OptimizelySDKUserProfileService.framework $(SRCROOT)/Carthage/Build/<platform>/OptimizelySDK<platform>.framework </pre>
For more installation information, see the [Carthage GitHub repository](🔗).
### Manual installation
The universal framework can be used in an application without the need for a third-party dependency manager. The universal framework packages up all Optimizely X Mobile modules, which include:
<pre> OptimizelySDKCore OptimizelySDKShared OptimizelySDKDatafileManager OptimizelySDKEventDispatcher OptimizelySDKUserProfileService </pre>
The universal framework for iOS includes builds for these architectures:
<pre> i386 x86_64 ARMv7 ARMv7s ARM64 </pre>
The universal framework for tvOS includes build for these architectures:
<pre> x86_64 ARM64 </pre>
Bitcode is enabled for both the iOS and tvOS universal frameworks.
To install the universal framework:
Download the [iOS](🔗) or [tvOS](🔗) framework.
Unzip the framework, then drag the framework to your project in Xcode. Xcode should prompt you to select a target. Go to **Build Phases** and make sure that the framework is under the **Link Binary with Libraries** section.
Go to the **General** tab and add the framework to the **Embedded Binaries** section. If the **Embedded Binaries** section is not visible, add the framework in the **Copy Files** section (you can add this section in **Build Settings**).
The Apple store will reject your app if you have the universal framework installed as it includes simulator binaries. You must run a script to strip the extra binaries before you upload the app. To do this, go to **Build Phases** and add a **Run Script** section by clicking the `
+` symbol. Copy and paste the script below, replacing the `
FRAMEWORK_NAME` with the proper framework name:
To build the universal framework:
Build the _OptimizelySDKiOS-Universal_ or _OptimizelySDKTVOS-Universal_ schemes.
Update our third-party dependencies, which are pulled in as Git submodules, by running this command:
After building these schemes, the frameworks are output in the _OptimizelySDKUniversal/generated-frameworks_ folder.
The full source code is at <https://github.com/optimizely/objective-c-sdk>.