I’m trying to build the Android side of my RN project. I’m not sure what causes this kind of “package <…> does not exist” build error. I want to confirm whether this issue is stemming from my use of Gradle, rather than React Native or the package.
terminal output of ./gradlew clean assemble
> Task :app:compileDebugJavaWithJavac FAILED
../my-react-project/android/app/src/main/java/com/tcgscan/CardInferenceFrameProcessorPlugin.java:11: error: package com.mrousavy.camera.frameprocessor does not exist
import com.mrousavy.camera.frameprocessor.FrameProcessorPlugin;
^
../my-react-project/android/app/src/main/java/com/tcgscan/CardInferenceFrameProcessorPlugin.java:12: error: package com.mrousavy.camera.frameprocessor does not exist
import com.mrousavy.camera.frameprocessor.VisionCameraProxy;
^
../my-react-project/android/app/src/main/java/com/tcgscan/CardInferenceFrameProcessorPlugin.java:13: error: package com.mrousavy.camera.frameprocessor does not exist
import com.mrousavy.camera.frameprocessor.Frame;
^
../my-react-project/android/app/src/main/java/com/tcgscan/CardInferenceFrameProcessorPlugin.java:46: error: cannot find symbol
public class CardInferenceFrameProcessorPlugin extends FrameProcessorPlugin {
^
symbol: class FrameProcessorPlugin
../my-react-project/android/app/src/main/java/com/tcgscan/CardInferenceFrameProcessorPlugin.java:47: error: cannot find symbol
CardInferenceFrameProcessorPlugin(@NonNull VisionCameraProxy proxy, @Nullable Map<String, Object> options) {
^
symbol: class VisionCameraProxy
location: class CardInferenceFrameProcessorPlugin
../my-react-project/android/app/src/main/java/com/tcgscan/CardInferenceFrameProcessorPlugin.java:180: error: cannot find symbol
public Object callback(Frame frame, Map<String, Object> params) {
^
symbol: class Frame
location: class CardInferenceFrameProcessorPlugin
../my-react-project/android/app/src/main/java/com/tcgscan/CardInferenceFrameProcessorPluginPackage.java:9: error: package com.mrousavy.camera.frameprocessor does not exist
import com.mrousavy.camera.frameprocessor.FrameProcessorPlugin;
^
../my-react-project/android/app/src/main/java/com/tcgscan/CardInferenceFrameProcessorPluginPackage.java:10: error: package com.mrousavy.camera.frameprocessor does not exist
import com.mrousavy.camera.frameprocessor.FrameProcessorPluginRegistry;
^
/Users/connorjones/cardbook3/mobile-client2/android/app/src/main/java/com/tcgscan/CardInferenceFrameProcessorPlugin.java:179: error: method does not override or implement a method from a supertype
@Override
^
../my-react-project/android/app/src/main/java/com/tcgscan/CardInferenceFrameProcessorPlugin.java:378: error: incompatible types: Plane[] cannot be converted to PlaneProxy[]
final PlaneProxy[] planes = image.getPlanes();
^
../my-react-project/android/app/src/main/java/com/tcgscan/CardInferenceFrameProcessorPlugin.java:379: error: incompatible types: PlaneProxy[] cannot be converted to Plane[]
fillBytesCameraX(planes, yuvBytes);
^
../my-react-project/android/app/src/main/java/com/tcgscan/CardInferenceFrameProcessorPluginPackage.java:17: error: cannot find symbol
FrameProcessorPluginRegistry.addFrameProcessorPlugin("cardInference", CardInferenceFrameProcessorPlugin::new);
^
symbol: variable FrameProcessorPluginRegistry
location: class CardInferenceFrameProcessorPluginPackage
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
12 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
> Run with --info option to get more log output.
> Run with --scan to get full insights.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 37s
276 actionable tasks: 270 executed, 6 up-to-date
Here is my build.gradle
buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 21
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "25.1.8937393"
kotlinVersion = "1.8.0"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
}
}
apply plugin: "com.facebook.react.rootproject"
here’s the settings.gradle
rootProject.name = 'myProject'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')