Last active
June 15, 2022 09:00
-
-
Save achuvm/fe0136818158bec2cdf4d1cd11053f6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/android/app/build.gradle b/android/app/build.gradle | |
index e381dda..a9ba303 100644 | |
--- a/android/app/build.gradle | |
+++ b/android/app/build.gradle | |
@@ -94,7 +94,8 @@ def enableSeparateBuildPerCPUArchitecture = false | |
def enableProguardInReleaseBuilds = false | |
android { | |
- compileSdkVersion rootProject.ext.compileSdkVersion | |
+ compileSdkVersion 28 | |
+ flavorDimensions "platform" | |
compileOptions { | |
sourceCompatibility JavaVersion.VERSION_1_8 | |
@@ -103,8 +104,9 @@ android { | |
defaultConfig { | |
applicationId "com.virosample" | |
- minSdkVersion rootProject.ext.minSdkVersion | |
- targetSdkVersion rootProject.ext.targetSdkVersion | |
+ minSdkVersion 23 | |
+ targetSdkVersion 28 | |
+ multiDexEnabled true | |
versionCode 1 | |
versionName "1.0" | |
} | |
@@ -116,6 +118,21 @@ android { | |
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" | |
} | |
} | |
+ productFlavors { | |
+ ar { | |
+ resValue 'string', 'app_name', 'ViroSample-ar' | |
+ buildConfigField 'String', 'VR_PLATFORM', '"GVR"' //default to GVR | |
+ } | |
+ gvr { | |
+ resValue 'string', 'app_name', 'ViroSample-gvr' | |
+ buildConfigField 'String', 'VR_PLATFORM', '"GVR"' | |
+ } | |
+ ovr { | |
+ resValue 'string', 'app_name', 'ViroSample-ovr' | |
+ applicationIdSuffix '.ovr' | |
+ buildConfigField 'String', 'VR_PLATFORM', '"OVR_MOBILE"' | |
+ } | |
+ } | |
buildTypes { | |
release { | |
minifyEnabled enableProguardInReleaseBuilds | |
@@ -138,9 +155,20 @@ android { | |
} | |
dependencies { | |
- implementation fileTree(dir: "libs", include: ["*.jar"]) | |
- implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" | |
- implementation "com.facebook.react:react-native:+" // From node_modules | |
+ implementation fileTree(dir: 'libs', include: ['*.jar']) | |
+ implementation 'com.android.support:appcompat-v7:28.0.0' | |
+ implementation 'com.facebook.react:react-native:+' | |
+ implementation project(':arcore_client') // remove this if AR not required | |
+ 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' | |
} | |
// Run this once to be able to run the application with BUCK | |
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml | |
index 6ba10b1..50d82c0 100644 | |
--- a/android/app/src/main/AndroidManifest.xml | |
+++ b/android/app/src/main/AndroidManifest.xml | |
@@ -2,6 +2,7 @@ | |
package="com.virosample"> | |
<uses-permission android:name="android.permission.INTERNET" /> | |
+ <uses-permission android:name="android.permission.CAMERA" /> | |
<application | |
android:name=".MainApplication" | |
@@ -9,18 +10,21 @@ | |
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" | |
android:label="@string/app_name" | |
- android:configChanges="keyboard|keyboardHidden|orientation|screenSize" | |
+ android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" | |
android:windowSoftInputMode="adjustResize"> | |
<intent-filter> | |
<action android:name="android.intent.action.MAIN" /> | |
<category android:name="android.intent.category.LAUNCHER" /> | |
+ <category android:name="com.google.intent.category.CARDBOARD" /> | |
</intent-filter> | |
</activity> | |
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" /> | |
+ <meta-data android:name="com.google.ar.core" android:value="optional" /> | |
</application> | |
</manifest> | |
diff --git a/android/app/src/main/java/com/virosample/MainApplication.java b/android/app/src/main/java/com/virosample/MainApplication.java | |
index 2e279a8..deaecae 100644 | |
--- a/android/app/src/main/java/com/virosample/MainApplication.java | |
+++ b/android/app/src/main/java/com/virosample/MainApplication.java | |
@@ -6,6 +6,8 @@ import com.facebook.react.ReactApplication; | |
import com.facebook.react.ReactNativeHost; | |
import com.facebook.react.ReactPackage; | |
import com.facebook.react.shell.MainReactPackage; | |
+ | |
+import com.viromedia.bridge.ReactViroPackage; | |
import com.facebook.soloader.SoLoader; | |
import java.util.Arrays; | |
@@ -22,7 +24,8 @@ public class MainApplication extends Application implements ReactApplication { | |
@Override | |
protected List<ReactPackage> getPackages() { | |
return Arrays.<ReactPackage>asList( | |
- new MainReactPackage() | |
+ new MainReactPackage(), | |
+ new ReactViroPackage(ReactViroPackage.ViroPlatform.valueOf(BuildConfig.VR_PLATFORM)) | |
); | |
} | |
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml | |
index 5755f2a..8542005 100644 | |
--- a/android/app/src/main/res/values/strings.xml | |
+++ b/android/app/src/main/res/values/strings.xml | |
@@ -1,3 +1,2 @@ | |
<resources> | |
- <string name="app_name">ViroSample</string> | |
</resources> | |
diff --git a/android/build.gradle b/android/build.gradle | |
index c6e7c7c..0e89926 100644 | |
--- a/android/build.gradle | |
+++ b/android/build.gradle | |
@@ -1,19 +1,12 @@ | |
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
- ext { | |
- buildToolsVersion = "28.0.3" | |
- minSdkVersion = 16 | |
- compileSdkVersion = 28 | |
- targetSdkVersion = 28 | |
- supportLibVersion = "28.0.0" | |
- } | |
repositories { | |
google() | |
jcenter() | |
} | |
dependencies { | |
- classpath 'com.android.tools.build:gradle:3.3.1' | |
+ classpath 'com.android.tools.build:gradle:3.3.0' | |
// NOTE: Do not place your application dependencies here; they belong | |
// in the individual module build.gradle files | |
@@ -21,8 +14,16 @@ buildscript { | |
} | |
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/' | |
+ } | |
google() | |
jcenter() | |
maven { | |
diff --git a/android/settings.gradle b/android/settings.gradle | |
index e646b99..5255fa5 100644 | |
--- a/android/settings.gradle | |
+++ b/android/settings.gradle | |
@@ -1,3 +1,8 @@ | |
rootProject.name = 'ViroSample' | |
include ':app' | |
+include ':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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | |
<application> | |
<meta-data | |
android:name="com.samsung.android.vr.application.mode" | |
android:value="vr_only"/> | |
</application> | |
</manifest> |
@akeemphilbert Thank you very much for your gist you made. It helped me and after few minutes mine works just fine and I'm up and running with AR in React Native.
can I see your source code ? my App always error, plz...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@akeemphilbert Thank you very much for your gist you made. It helped me and after few minutes mine works just fine and I'm up and running with AR in React Native.