Skip to content

Instantly share code, notes, and snippets.

@alexandrtovmach
Last active July 12, 2021 15:25
Show Gist options
  • Save alexandrtovmach/f0205dc5af196f6df1e7a6311f23a42f to your computer and use it in GitHub Desktop.
Save alexandrtovmach/f0205dc5af196f6df1e7a6311f23a42f to your computer and use it in GitHub Desktop.

android/app/build.gradle

--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -80,6 +80,8 @@ import com.android.build.OutputFile
 
 project.ext.react = [
     enableHermes: true,  // clean and rebuild if changing
+    entryFile: "index.js",
+    bundleAssetName: "app.bundle",
 ]
 
 apply from: "../../node_modules/react-native/react.gradle"
@@ -180,6 +182,10 @@ android {
         }
     }
 
+    packagingOptions {
+        exclude 'META-INF/react-native-webview_release.kotlin_module'
+    }
+
     // applicationVariants are e.g. debug, release
     applicationVariants.all { variant ->
         variant.outputs.each { output ->
@@ -204,6 +210,28 @@ dependencies {
     //noinspection GradleDynamicVersion
     implementation "com.facebook.react:react-native:+"  // From node_modules
     implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
+
+    implementation(project(':react-native-jitsi-meet')) {
+      exclude group: 'com.facebook.react',module:'react-native-locale-detector'
+      exclude group: 'com.facebook.react',module:'react-native-vector-icons'
+      // Un-comment below if using hermes
+      // exclude group: 'com.facebook',module:'hermes'
+      // Un-comment any packages below that you have added to your project to prevent `duplicate_classes` errors
+      exclude group: 'com.facebook.react',module:'react-native-google-signin'
+      exclude group: 'com.facebook.react',module:'react-native-community-async-storage'
+      exclude group: 'com.facebook.react',module:'react-native-community_netinfo'
+      exclude group: 'com.facebook.react',module:'react-native-svg'
+      // // exclude group: 'com.facebook.react',module:'react-native-fetch-blob'
+      exclude group: 'com.facebook.react',module:'react-native-webview'
+      // exclude group: 'com.facebook.react',module:'react-native-linear-gradient'
+      // exclude group: 'com.facebook.react',module:'react-native-sound'
+    }
+
+
+    debugImplementation(project(':react-native-jitsi-meet')) {
+      exclude group: 'com.facebook',module:'hermes'
+    }
+
     addUnimodulesDependencies()
 
     debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {

android/app/src/debug/AndroidManifest.xml

--- a/android/app/src/debug/AndroidManifest.xml
+++ b/android/app/src/debug/AndroidManifest.xml
@@ -4,5 +4,5 @@
 
     <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
 
-    <application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
+    <application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" android:allowBackup="true" tools:replace="android:allowBackup" />
 </manifest>

android/app/src/main/AndroidManifest.xml

--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -1,8 +1,8 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.myapp">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.myapp">
 
   <uses-permission android:name="android.permission.INTERNET" />
 
-  <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:theme="@style/AppTheme">
+  <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:theme="@style/AppTheme" tools:replace="android:allowBackup">
     <activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustPan">
       <intent-filter>
         <action android:name="android.intent.action.MAIN" />

android/app/src/main/java/com/myapp/MainApplication.java

--- a/android/app/src/main/java/com/myapp/MainApplication.java
+++ b/android/app/src/main/java/com/myapp/MainApplication.java
@@ -13,6 +13,7 @@ import com.facebook.soloader.SoLoader;
 import java.lang.reflect.InvocationTargetException;
 import java.util.List;
 import java.util.Arrays;
+import androidx.annotation.Nullable;
 
 import org.unimodules.adapters.react.ModuleRegistryAdapter;
 import org.unimodules.adapters.react.ReactModuleRegistryProvider;
@@ -47,6 +48,11 @@ public class MainApplication extends Application implements ReactApplication {
         protected String getJSMainModuleName() {
           return "index";
         }
+
+        @Override
+        protected @Nullable String getBundleAssetName() {
+          return "app.bundle";
+        }
       };
 
   @Override

android/build.gradle

--- a/android/build.gradle
+++ b/android/build.gradle
@@ -31,6 +31,9 @@ allprojects {
             // Android JSC is installed from npm
             url("$rootDir/../node_modules/jsc-android/dist")
         }
+        maven { // <---- Add this block
+            url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases"
+        }
 
         google()
         jcenter()

metro.config.js

--- a/metro.config.js
+++ b/metro.config.js
@@ -1,4 +1,5 @@
 const { getDefaultConfig } = require('metro-config')
+const blacklist = require('metro-config/src/defaults/blacklist')
 
 module.exports = (async () => {
   const {
@@ -12,7 +13,10 @@ module.exports = (async () => {
     },
     resolver: {
       assetExts: assetExts.filter((ext) => ext !== 'svg'),
-      sourceExts: [...sourceExts, 'svg']
+      sourceExts: [...sourceExts, 'svg'],
+      blacklistRE: blacklist([
+        /ios\/Pods\/JitsiMeetSDK\/Frameworks\/JitsiMeet.framework\/assets\/node_modules\/react-native\/.*/
+      ])
     }
   }
 })()

package.json

--- a/package.json
+++ b/package.json
@@ -21,7 +21,7 @@
     "@react-native-community/datetimepicker": "3.0.9",
     "@react-native-community/google-signin": "^5.0.0",
     "@react-native-community/masked-view": "^0.1.10",
-    "@react-native-community/netinfo": "^5.9.10",
+    "@react-native-community/netinfo": "4.7.0",
     "@react-native-community/picker": "^1.6.6",
     "@react-native-community/slider": "^3.0.3",
     "@react-navigation/bottom-tabs": "^5.11.7",
@@ -46,6 +46,7 @@
     "react-native-email-link": "^1.9.2",
     "react-native-gesture-handler": "^1.9.0",
     "react-native-image-picker": "^3.1.4",
+    "react-native-jitsi-meet": "^2.1.1",
     "react-native-keyboard-aware-scroll-view": "^0.9.2",
     "react-native-localize": "^2.0.1",
     "react-native-modal": "^11.6.1",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment