Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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')
@OguzhanArslann

This comment has been minimized.

Copy link

@OguzhanArslann OguzhanArslann commented May 1, 2020

This is for ViroReact 2.17.0 and RN 0.62, am i wrong?

@saqibsharif62

This comment has been minimized.

Copy link

@saqibsharif62 saqibsharif62 commented Sep 29, 2020

I'm a beginner in react native and trying to develop an Augmented Reality app for my Final Year Project. I have no idea how to start with Viro React. I've installed react-viro 2.7.3 but have no idea how to use this gist in my react-native project. Can you please tell me how to use this gist with my React Native Project.

@akeemphilbert

This comment has been minimized.

Copy link
Owner Author

@akeemphilbert akeemphilbert commented Sep 30, 2020

You should be able to apply the patch to the android project. - https://git-scm.com/docs/git-apply

@sankar9659

This comment has been minimized.

Copy link

@sankar9659 sankar9659 commented Oct 21, 2020

App crashed in all android devices,
I have followed the above linking method.

"create-react-class": "^15.7.0",
"react": "16.13.1",
"react-native": "0.63.3",
"react-native-permissions": "^2.2.2",
"react-viro": "2.17.0"

In app.js

<ViroARScene onTrackingUpdated={this._onInitialized}>
<ViroText
text={this.state.text}
scale={[ 0.5, 0.5, 0.5 ]}
position={[ 0, 0, -1 ]}
style={styles.helloWorldTextStyle}
/>
``

@sankar9659

This comment has been minimized.

Copy link

@sankar9659 sankar9659 commented Oct 21, 2020

I got this lines in console,

{"RECORD_ERROR_ALREADY_RUNNING": 4, "RECORD_ERROR_ALREADY_STOPPED": 5, "RECORD_ERROR_INITIALIZATION": 2, "RECORD_ERROR_NONE": -1, "RECORD_ERROR_NO_PERMISSION": 1, "RECORD_ERROR_UNKNOWN": 0, "RECORD_ERROR_WRITE_TO_FILE": 3, "TRACKING_LIMITED": 2, "TRACKING_NORMAL": 3, "TRACKING_REASON_EXCESSIVE_MOTION": 2, "TRACKING_REASON_INSUFFICIENT_FEATURES": 3, "TRACKING_REASON_NONE": 1, "TRACKING_UNAVAILABLE": 1}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.