I'm trying to install react-native-google-cast.
I performed the steps described.
In the documentation it says:
No additional setup needed thanks to autolinking.
Once I ran the react-native link
command and it did the linking.
If I try it doesn't work, so I don't have to run any commands?
As soon as I install the library it gives me the following error:
info JS server already running.
info Installing the app...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'nptest'.
> Could not open cp_proj generic class cache for build file '/Users/userName/Desktop/testApk/mks/android/build.gradle' (/Users/userName/.gradle/caches/7.5.1/scripts/e7l213puljy1f81zmlggf68ny).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 64
* 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 3s
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:
A problem occurred configuring root project 'nptest'.
> Could not open cp_proj generic class cache for build file '/Users/userName/Desktop/testApk/mks/android/build.gradle' (/Users/userName/.gradle/caches/7.5.1/scripts/e7l213puljy1f81zmlggf68ny).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 64
* 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 3s
at makeError (/Users/userName/Desktop/testApk/mks/node_modules/execa/index.js:174:9)
at /Users/userName/Desktop/testApk/mks/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/userName/Desktop/testApk/mks/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:82:7)
at async Command.handleAction (/Users/userName/Desktop/testApk/mks/node_modules/@react-native-community/cli/build/index.js:108:9)
info Run CLI with --verbose flag for more details.
If I try to remove the library after a few tries it works again.
If I put it back it doesn't work anymore.
If I go to see the PackageList
file in android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java
I see this:
package com.facebook.react;
import android.app.Application;
import android.content.Context;
import android.content.res.Resources;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainPackageConfig;
import com.facebook.react.shell.MainReactPackage;
import java.util.Arrays;
import java.util.ArrayList;
// @react-native-community/netinfo
import com.reactnativecommunity.netinfo.NetInfoPackage;
// react-native-gesture-handler
import com.swmansion.gesturehandler.RNGestureHandlerPackage;
// react-native-safe-area-context
import com.th3rdwave.safeareacontext.SafeAreaContextPackage;
// react-native-screens
import com.swmansion.rnscreens.RNScreensPackage;
// react-native-vector-icons
import com.oblador.vectoricons.VectorIconsPackage;
// react-native-webview
import com.reactnativecommunity.webview.RNCWebViewPackage;
public class PackageList {
private Application application;
private ReactNativeHost reactNativeHost;
private MainPackageConfig mConfig;
public PackageList(ReactNativeHost reactNativeHost) {
this(reactNativeHost, null);
}
public PackageList(Application application) {
this(application, null);
}
public PackageList(ReactNativeHost reactNativeHost, MainPackageConfig config) {
this.reactNativeHost = reactNativeHost;
mConfig = config;
}
public PackageList(Application application, MainPackageConfig config) {
this.reactNativeHost = null;
this.application = application;
mConfig = config;
}
private ReactNativeHost getReactNativeHost() {
return this.reactNativeHost;
}
private Resources getResources() {
return this.getApplication().getResources();
}
private Application getApplication() {
if (this.reactNativeHost == null) return this.application;
return this.reactNativeHost.getApplication();
}
private Context getApplicationContext() {
return this.getApplication().getApplicationContext();
}
public ArrayList<ReactPackage> getPackages() {
return new ArrayList<>(Arrays.<ReactPackage>asList(
new MainReactPackage(mConfig),
new NetInfoPackage(),
new RNGestureHandlerPackage(),
new SafeAreaContextPackage(),
new RNScreensPackage(),
new VectorIconsPackage(),
new RNCWebViewPackage()
));
}
}
But I can't find the one from react-native-google-cast
.
Do you think it has something to do with it?
Can you give me a hand?