Android Setup Guide
This guide provides Android-specific instructions for integrating Source Push into your React Native application.
Note: For general installation and SDK setup, see the React Native SDK Setup guide first. This page covers only Android-specific configuration steps.
Prerequisites
Before you begin, ensure you have:
- Android Studio installed
- React Native development environment set up
- Source Push account and access token
- JDK 11 or newer
Android Platform Setup
1. Configure the Source Push Maven Repository
Add the Source Push maven repository in android/build.gradle
:
allprojects {
repositories {
maven { url "https://api.srcpush.com/maven" }
// ... other repositories
}
}
2. Update Gradle Settings
Add the following to android/settings.gradle
:
include ':app', ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/@srcpush/react-native-code-push/android/app')
3. Update App Gradle
Modify android/app/build.gradle
:
apply from: "../../node_modules/@srcpush/react-native-code-push/android/codepush.gradle"
android {
defaultConfig {
// ... other configs
buildConfigField "String", "CODEPUSH_KEY", '"Your-Deployment-Key"'
}
}
4. Configure MainApplication.java
Add Source Push initialization to your MainApplication.java
as described in the React Native SDK Setup guide.
5. Add Source Push Configuration to strings.xml
<resources>
<string moduleConfig="true" name="CodePushDeploymentKey">Your-Deployment-Key</string>
<string moduleConfig="true" name="CodePushServerUrl">https://api.srcpush.com</string>
</resources>
Advanced Configuration
See React Native SDK Setup for advanced options and best practices.
Troubleshooting
For common issues and solutions, refer to the Troubleshooting Guide.