【问题标题】:React Native: Android simulator starts but app doesn't openReact Native:Android模拟器启动但应用程序未打开
【发布时间】:2018-02-23 22:02:33
【问题描述】:

我使用 this guide 安装了 Android Studio。我有 Android Studio 3.0.1 和 Java 版本 1.8.0_161,在 Macbook Pro 上运行:MacOS High Sierra,具有 Core i7 和 16GB RAM。

我正在开发一个应用程序,并且我已经使用 iOS 模拟器有一段时间了,最​​近开始尝试在 android 模拟器上测试该应用程序。我在 Android Studio 中打开应用程序(确保选择 React 项目中的 android 子文件夹作为我的根项目文件夹),然后点击“运行应用程序”以启动模拟器,它确实运行。但是,我只看到模拟手机的主屏幕,应用程序没有启动。我收到这些错误:

/Users/myUser/Documents/myProject/node_modules/react-native-permissions/android/src/main/java/com/joshblour/reactnativepermissions/ReactNativePermissionsPackage.java
Error:(19, 5) error: method does not override or implement a method from a supertype


Error:Execution failed for task ':react-native-permissions:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

【问题讨论】:

  • 你使用的是什么版本的 react-native 和 react-native-permissions?
  • @ajthyng react-native 0.49.3 和 react-native-permissions 0.2.7
  • 不确定这是否是您的问题,但自述文件提供了版本表,并且 RN 0.40 - 0.52 需要 react-native-permissions 的 1.1.1 版本。 github.com/yonahforst/react-native-permissions
  • 当我升级 react-native-permissions 的版本时,我在 AS 中收到此错误:Unable to find a matching configuration of project :react-native-permissions: None of the consumable configurations have attributes.

标签: react-native android-studio-3.0


【解决方案1】:

删除以下方法(在 ReactNativePermissionsPackage.java 文件内)上的 @Override 会删除上述错误:

@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  return Collections.emptyList();
}

【讨论】:

    猜你喜欢
    • 2019-10-01
    • 1970-01-01
    • 2019-08-07
    • 2012-04-14
    • 1970-01-01
    • 2013-11-22
    • 1970-01-01
    • 1970-01-01
    • 2017-12-13
    相关资源
    最近更新 更多