1diff --git a/android/app/build.gradle b/android/app/build.gradle 2index 19d0b1b..e5b1a7d 100644 3--- a/android/app/build.gradle 4+++ b/android/app/build.gradle 5@@ -1,6 +1,7 @@ 6 apply plugin: "com.android.application" 7+apply from: '../../node_modules/react-native-unimodules/gradle.groovy' 8 9 import com.android.build.OutputFile 10 11 /** 12 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 13@@ -185,10 +186,12 @@ dependencies { 14 //noinspection GradleDynamicVersion 15 implementation "com.facebook.react:react-native:+" // From node_modules 16 17 implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" 18 19+ addUnimodulesDependencies() 20+ 21 debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { 22 exclude group:'com.facebook.fbjni' 23 } 24 25 debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { 26diff --git a/android/app/src/main/java/com/myapp/MainApplication.java b/android/app/src/main/java/com/myapp/MainApplication.java 27index dc0901c..0151e90 100644 28--- a/android/app/src/main/java/com/myapp/MainApplication.java 29+++ b/android/app/src/main/java/com/myapp/MainApplication.java 30@@ -1,19 +1,28 @@ 31 package com.myapp; 32 33+// com.myapp should be your package name 34+import com.myapp.generated.BasePackageList; 35+ 36 import android.app.Application; 37 import android.content.Context; 38 import com.facebook.react.PackageList; 39 import com.facebook.react.ReactApplication; 40 import com.facebook.react.ReactInstanceManager; 41 import com.facebook.react.ReactNativeHost; 42 import com.facebook.react.ReactPackage; 43 import com.facebook.soloader.SoLoader; 44 import java.lang.reflect.InvocationTargetException; 45 import java.util.List; 46+import java.util.Arrays; 47+ 48+import org.unimodules.adapters.react.ModuleRegistryAdapter; 49+import org.unimodules.adapters.react.ReactModuleRegistryProvider; 50+import org.unimodules.core.interfaces.SingletonModule; 51 52 public class MainApplication extends Application implements ReactApplication { 53+ private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(new BasePackageList().getPackageList(), null); 54 55 private final ReactNativeHost mReactNativeHost = 56 new ReactNativeHost(this) { 57 @Override 58 public boolean getUseDeveloperSupport() { 59@@ -24,10 +33,16 @@ public class MainApplication extends Application implements ReactApplication { 60 protected List<ReactPackage> getPackages() { 61 @SuppressWarnings("UnnecessaryLocalVariable") 62 List<ReactPackage> packages = new PackageList(this).getPackages(); 63 // Packages that cannot be autolinked yet can be added manually here, for example: 64 // packages.add(new MyReactNativePackage()); 65+ 66+ // Add unimodules 67+ List<ReactPackage> unimodules = Arrays.<ReactPackage>asList( 68+ new ModuleRegistryAdapter(mModuleRegistryProvider) 69+ ); 70+ packages.addAll(unimodules); 71 return packages; 72 } 73 74 @Override 75 protected String getJSMainModuleName() { 76diff --git a/android/build.gradle b/android/build.gradle 77index ed5a568..0547dbf 100644 78--- a/android/build.gradle 79+++ b/android/build.gradle 80@@ -1,11 +1,11 @@ 81 // Top-level build file where you can add configuration options common to all sub-projects/modules. 82 83 buildscript { 84 ext { 85 buildToolsVersion = "29.0.2" 86- minSdkVersion = 16 87+ minSdkVersion = 21 88 compileSdkVersion = 29 89 targetSdkVersion = 29 90 } 91 repositories { 92 google() 93diff --git a/android/settings.gradle b/android/settings.gradle 94index 13885ee..c673a40 100644 95--- a/android/settings.gradle 96+++ b/android/settings.gradle 97@@ -1,3 +1,4 @@ 98 rootProject.name = 'MyApp' 99+apply from: '../node_modules/react-native-unimodules/gradle.groovy'; includeUnimodulesProjects() 100 apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 101 include ':app' 102