我使用expo工作流程创建了一个项目,但是由于某些原因,我不得不将其弹出以完全响应本机工作流程。弹出后,如果我安装了任何expo软件包。在android构建上,它给了我一个错误,该错误主要与ModuleRegistryConsumer有关。对于包内的各种文件,我会收到此错误。
BUILD FAILED in 11s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
D:\ReactNativeProjects\EjectTest\ejecttest1\node_modules\expo-av\android\src\main\java\expo\modules\av\AVManager.java:23: error: cannot find symbol
import org.unimodules.core.interfaces.ModuleRegistryConsumer;
^
symbol: class ModuleRegistryConsumer
location: package org.unimodules.core.interfaces
D:\ReactNativeProjects\EjectTest\ejecttest1\node_modules\expo-av\android\src\main\java\expo\modules\av\AVManager.java:45: error: cannot find symbol
public class AVManager implements LifecycleEventListener, AudioManager.OnAudioFocusChangeListener, MediaRecorder.OnInfoListener, AVManagerInterface, InternalModule, ModuleRegistryConsumer {
^
symbol: class ModuleRegistryConsumer
D:\ReactNativeProjects\EjectTest\ejecttest1\node_modules\expo-av\android\src\main\java\expo\modules\av\video\VideoViewManager.java:14: error: cannot find symbol
import org.unimodules.core.interfaces.ModuleRegistryConsumer;
^
symbol: class ModuleRegistryConsumer
location: package org.unimodules.core.interfaces
D:\ReactNativeProjects\EjectTest\ejecttest1\node_modules\expo-av\android\src\main\java\expo\modules\av\video\VideoViewManager.java:16: error: cannot find symbol
public class VideoViewManager extends ViewManager<VideoViewWrapper> implements ModuleRegistryConsumer {
^
symbol: class ModuleRegistryConsumer
D:\ReactNativeProjects\EjectTest\ejecttest1\node_modules\expo-av\android\src\main\java\expo\modules\av\AVModule.java:10: error: cannot find symbol
import org.unimodules.core.interfaces.ModuleRegistryConsumer;
^
symbol: class ModuleRegistryConsumer
location: package org.unimodules.core.interfaces
D:\ReactNativeProjects\EjectTest\ejecttest1\node_modules\expo-av\android\src\main\java\expo\modules\av\AVModule.java:12: error: cannot find symbol
public class AVModule extends ExportedModule implements ModuleRegistryConsumer {
^
symbol: class ModuleRegistryConsumer
D:\ReactNativeProjects\EjectTest\ejecttest1\node_modules\expo-av\android\src\main\java\expo\modules\av\video\VideoManager.java:15: error: cannot find symbol
import org.unimodules.core.interfaces.ModuleRegistryConsumer;
^
symbol: class ModuleRegistryConsumer
location: package org.unimodules.core.interfaces
D:\ReactNativeProjects\EjectTest\ejecttest1\node_modules\expo-av\android\src\main\java\expo\modules\av\video\VideoManager.java:18: error: cannot find symbol
public class VideoManager extends ExportedModule implements ModuleRegistryConsumer {
^
symbol: class ModuleRegistryConsumer
D:\ReactNativeProjects\EjectTest\ejecttest1\node_modules\expo-av\android\src\main\java\expo\modules\av\AVManager.java:119: error: method does not override or implement a method from a supertype
@Override
^
D:\ReactNativeProjects\EjectTest\ejecttest1\node_modules\expo-av\android\src\main\java\expo\modules\av\AVManager.java:503: error: cannot find symbol
return mModuleRegistry.getModule(Permissions.class).getPermission(Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED;
^
symbol: method getPermission(String)
location: interface Permissions
D:\ReactNativeProjects\EjectTest\ejecttest1\node_modules\expo-av\android\src\main\java\expo\modules\av\video\VideoViewManager.java:26: error: method does not override or implement a method from a supertype
@Override
^
D:\ReactNativeProjects\EjectTest\ejecttest1\node_modules\expo-av\android\src\main\java\expo\modules\av\AVModule.java:24: error: method does not override or implement a method from a supertype
@Override
^
D:\ReactNativeProjects\EjectTest\ejecttest1\node_modules\expo-av\android\src\main\java\expo\modules\av\video\VideoManager.java:42: error: method does not override or implement a method from a supertype
@Override
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: D:\ReactNativeProjects\EjectTest\ejecttest1\node_modules\expo-av\android\src\main\java\expo\modules\av\player\PlayerData.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
13 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':expo-av:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 11s
at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (D:\ReactNativeProjects\EjectTest\ejecttest1\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at processTicksAndRejections (internal/process/task_queues.js:85:5)
at async Command.handleAction (D:\ReactNativeProjects\EjectTest\ejecttest1\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:164:9)
这是运行react-native run-android后显示的所有错误的日志。
我的开发环境是。 -Expo SDK:36.0.0 -反应原生:0.61.5
答案 0 :(得分:0)
弹出后,您不再使用Expo enivrement,必须将android-studio设置为所需的内容,例如ADB,JAVAHOME,SDK ...
我建议您遵循react-native文档为Android和ios设置环境:docs
这次确保遵循React Native CLI快速入门路径。