HowTo: Modify theta-client React Native Demo using the React Native Paper library and other additional styles

As I normally use Flutter, I found this article on theta-client React Native demo interesting. Thank you for sharing it.

Initially, I had problems running the React Native demo itself.

yarn android
yarn run v1.22.22
$ react-native run-android
info Starting JS server...
info Installing the app...

FAILURE: Build failed with an exception.

* What went wrong:
Could not open settings generic class cache for settings file '/home/craig/Development/ricoh/2024/theta-client/demos/demo-react-native/android/settings.gradle' (/home/craig/.gradle/caches/7.5.1/scripts/72hrb2xr734f4zpavzjlq0bu3).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 525ms

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Could not open settings generic class cache for settings file '/home/craig/Development/ricoh/2024/theta-client/demos/demo-react-native/android/settings.gradle' (/home/craig/.gradle/caches/7.5.1/scripts/72hrb2xr734f4zpavzjlq0bu3).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63

Could not open settings generic class cache for settings file

I believe I found a workaround on Stackoverflow.

There was a mismatch between the version of Java I specified in JAVA_HOME and the version bundled with Android Studio.

Java 19.0.2 From Ubuntu 22.04

java -version
openjdk version "19.0.2" 2023-01-17
OpenJDK Runtime Environment (build 19.0.2+7-Ubuntu-0ubuntu322.04)
OpenJDK 64-Bit Server VM (build 19.0.2+7-Ubuntu-0ubuntu322.04, mixed mode, sharing)

Setting to Java 17.0.7 from Android Studio

On Ubuntu, Android Studio is often installed in a location that is specific to each person’s workstation. On my Linux computer, I have Android Studio installed

export JAVA_HOME="/opt/android-studio/jbr/"
export PATH=$JAVA_HOME/bin:$PATH
java -version
openjdk version "17.0.7" 2023-04-18
OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
OpenJDK 64-Bit Server VM (build 17.0.7+0-17.0.7b1000.6-10550314, mixed mode)

yarn android

Although the application installed, it did not run.

image

npx react-native start

image

select a

now it runs

linter error

image

The application works, so I’m just gong forward.

running on physical device

Live preview working.

Take picture works

List Photos work

Tip

I had more reliability with the 5GHz connection.
Turn off auto-sleep during testing and power your THETA X from a USB cable.

Dev Environment

Using physical THETA X and physical Google Pixel 4a.

image

Paper Install

Went Smoothly

Tooltip

SVG Image

image

Styling


I’m going to continue this fine tutorial by @shegz101 after a short break.

1 Like