Skip to content

Commit

Permalink
feat: configure codepush for android
Browse files Browse the repository at this point in the history
  • Loading branch information
tsyirvo committed Aug 31, 2020
1 parent 52ebb22 commit 014bcc8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ project.ext.react = [

apply from: "../../node_modules/react-native/react.gradle"

// CodePush config
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"

/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
Expand Down Expand Up @@ -147,6 +150,8 @@ android {
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true

resValue "string", "build_config_package", "com.rnstarter"

// Detox config
Expand Down
7 changes: 7 additions & 0 deletions android/app/src/main/java/com/rnstarter/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,17 @@
import java.lang.reflect.InvocationTargetException;
import java.util.List;

import com.microsoft.codepush.react.CodePush;

public class MainApplication extends Application implements ReactApplication {

private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}

@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
Expand Down
3 changes: 2 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ buildscript {
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
classpath('com.android.support:multidex:1.0.3')

// Detox config
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")

// Firebase config
classpath("com.google.gms:google-services:4.2.0")
classpath("com.google.gms:google-services:4.3.3")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.2.0")

// NOTE: Do not place your application dependencies here; they belong
Expand Down
3 changes: 2 additions & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
rootProject.name = 'rnStarter'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
include ':app', ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')

0 comments on commit 014bcc8

Please sign in to comment.