Skip to content

Instantly share code, notes, and snippets.

@akeemphilbert
Created April 13, 2020 18:24
Show Gist options
  • Save akeemphilbert/8323a7b71e682469b922920a624b35a8 to your computer and use it in GitHub Desktop.
Save akeemphilbert/8323a7b71e682469b922920a624b35a8 to your computer and use it in GitHub Desktop.
Patches for ViroReact + React Native 0.62
--- app/android/app/src/main/AndroidManifest.xml (date 1586122131892)
+++ app/android/app/src/main/AndroidManifest.xml (date 1586122131892)
@@ -2,6 +2,7 @@
package="com.app">
<uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.CAMERA" />
<application
android:name=".MainApplication"
@@ -9,6 +10,7 @@
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
+ android:usesCleartextTraffic="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
@@ -22,6 +24,7 @@
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
+ <meta-data android:name="com.google.ar.core" android:value="optional" />
</application>
</manifest>
--- app/build.gradle (date 1586133245000)
+++ app/build.gradle (date 1586133245000)
@@ -78,7 +78,7 @@
*/
project.ext.react = [
- enableHermes: false, // clean and rebuild if changing
+ enableHermes: false, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.gradle"
@@ -130,7 +130,7 @@
defaultConfig {
applicationId "com.app"
- minSdkVersion rootProject.ext.minSdkVersion
+ minSdkVersion 23
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
@@ -151,6 +151,7 @@
keyPassword 'android'
}
}
+
buildTypes {
debug {
signingConfig signingConfigs.debug
@@ -194,16 +195,30 @@
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+
+ implementation project(':arcore_client')
+ implementation project(':gvr_common')
+ implementation project(path: ':viro_renderer')
+ implementation project(path: ':react_viro')
+ implementation 'com.google.android.exoplayer:exoplayer:2.7.1'
+ implementation 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7'
+ implementation 'com.amazonaws:aws-android-sdk-core:2.7.7'
+ implementation 'com.amazonaws:aws-android-sdk-ddb:2.7.7'
+ implementation 'com.amazonaws:aws-android-sdk-ddb-mapper:2.7.7'
+ implementation 'com.amazonaws:aws-android-sdk-cognito:2.7.7'
+ implementation 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.7.7'
+
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
- exclude group:'com.facebook.fbjni'
+ exclude group: 'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
- exclude group:'com.facebook.flipper'
+ exclude group: 'com.facebook.flipper'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
- exclude group:'com.facebook.flipper'
+ exclude group: 'com.facebook.flipper'
}
if (enableHermes) {
--- build.gradle (date 1586132755000)
+++ build.gradle (date 1586132755000)
@@ -3,7 +3,7 @@
buildscript {
ext {
buildToolsVersion = "28.0.3"
- minSdkVersion = 16
+ minSdkVersion = 21
compileSdkVersion = 28
targetSdkVersion = 28
}
@@ -20,8 +20,16 @@
}
allprojects {
+ configurations.matching { it.name == '_internal_aapt2_binary' }.all { config ->
+ config.resolutionStrategy.eachDependency { details ->
+ details.useVersion("3.5.0-alpha03-5252756")
+ }
+ }
repositories {
mavenLocal()
+ maven {
+ url 'https://maven.google.com/'
+ }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
--- app/src/main/java/com/app/MainApplication.java (date 1586133925000)
+++ app/src/main/java/com/app/MainApplication.java (date 1586133925000)
@@ -10,6 +10,8 @@
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
+import com.viromedia.bridge.ReactViroPackage;
+import com.facebook.react.shell.MainReactPackage;
public class MainApplication extends Application implements ReactApplication {
@@ -25,7 +27,7 @@
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
- // packages.add(new MyReactNativePackage());
+ packages.add(new ReactViroPackage(ReactViroPackage.ViroPlatform.AR));
return packages;
}
--- settings.gradle (date 1586129024000)
+++ settings.gradle (date 1586129024000)
@@ -1,3 +1,7 @@
rootProject.name = 'app'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
-include ':app'
+include ':app', ':react_viro', ':arcore_client', ':gvr_common', ':viro_renderer'
+project(':arcore_client').projectDir = new File('../node_modules/react-viro/android/arcore_client')
+project(':gvr_common').projectDir = new File('../node_modules/react-viro/android/gvr_common')
+project(':viro_renderer').projectDir = new File('../node_modules/react-viro/android/viro_renderer')
+project(':react_viro').projectDir = new File('../node_modules/react-viro/android/react_viro')
@kitsbits
Copy link

kitsbits commented Jan 5, 2021

Ditto to the above - it's crashing on Android after implementing the patches suggested. Any news on an update for this?

@akeemphilbert
Copy link
Author

akeemphilbert commented Jan 5, 2021 via email

@jahau
Copy link

jahau commented Jan 21, 2021

Same here, crashing after these changes. Tried with react-native version 0.63.3.

@lmichailian
Copy link

Same here, crashing after these changes. Tried with react-native version 0.63.3.

Have you lucky? I'm struggling with the same

@ohszehong
Copy link

I'm getting > Task: app:processDebugResources FAILED when running npm run android after setting up those files.
using react-native: "~0.63.4"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment