реактивный apk не работает на устройстве android - PullRequest
0 голосов
/ 31 марта 2020

Это мой первый реактивный проект, и он довольно прост, в нем всего 2 экрана. Оба модуля работают нормально на производстве. Я использую выставку с голым рабочим процессом.

adb logcat выглядит так: -

FATAL EXCEPTION: mqt_native_modules
03-31 16:13:04.953 20227 20264 E AndroidRuntime: Process: com.project1, PID: 20227
03-31 16:13:04.953 20227 20264 E AndroidRuntime: com.facebook.react.common.JavascriptException: Invariant Violation: "project1" has not been registered. This can happen if:
03-31 16:13:04.953 20227 20264 E AndroidRuntime: * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
03-31 16:13:04.953 20227 20264 E AndroidRuntime: * A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., stack:
03-31 16:13:04.953 20227 20264 E AndroidRuntime: runApplication@337:1948
03-31 16:13:04.953 20227 20264 E AndroidRuntime: value@27:3685
03-31 16:13:04.953 20227 20264 E AndroidRuntime: <unknown>@27:841
03-31 16:13:04.953 20227 20264 E AndroidRuntime: value@27:2939
03-31 16:13:04.953 20227 20264 E AndroidRuntime: value@27:813
03-31 16:13:04.953 20227 20264 E AndroidRuntime: value@-1
03-31 16:13:04.953 20227 20264 E AndroidRuntime:
03-31 16:13:04.953 20227 20264 E AndroidRuntime:        at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:71)
03-31 16:13:04.953 20227 20264 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
03-31 16:13:04.953 20227 20264 E AndroidRuntime:        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:371)
03-31 16:13:04.953 20227 20264 E AndroidRuntime:        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:150)
03-31 16:13:04.953 20227 20264 E AndroidRuntime:        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
03-31 16:13:04.953 20227 20264 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:883)
03-31 16:13:04.953 20227 20264 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:100)
03-31 16:13:04.953 20227 20264 E AndroidRuntime:        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26)
03-31 16:13:04.953 20227 20264 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:214)
03-31 16:13:04.953 20227 20264 E AndroidRuntime:        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225)
03-31 16:13:04.953 20227 20264 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:919)

Я не знаю, что является причиной ошибки. Пожалуйста, помогите

Мой пакет. json выглядит так:

    {
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "web": "expo start --web",
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "@react-native-community/masked-view": "^0.1.7",
    "@react-navigation/native": "^5.1.4",
    "@react-navigation/stack": "^5.2.9",
    "expo": "~36.0.0",
    "expo-ads-admob": "^8.1.0",
    "react": "~16.9.0",
    "react-dom": "~16.9.0",
    "react-native": "~0.61.4",
    "react-native-gesture-handler": "^1.5.6",
    "react-native-reanimated": "^1.4.0",
    "react-native-safe-area-context": "^0.7.3",
    "react-native-screens": "^2.0.0-alpha.12",
    "react-native-unimodules": "~0.7.0",
    "react-native-web": "~0.11.7"
  },
  "devDependencies": {
    "@babel/core": "~7.6.0",
    "babel-jest": "~24.9.0",
    "jest": "~24.9.0",
    "metro-react-native-babel-preset": "~0.56.0",
    "react-test-renderer": "~16.9.0"
  },
  "jest": {
    "preset": "react-native"
  },
  "private": true
}

приложение. json файл: -

{
  "name": "Fifty Business Ideas",
  "displayName": "Fifty Business Ideas",
  "expo": {
    "name": "Fifty Business Ideas",
    "slug": "project1",
    "privacy": "unlisted",
    "sdkVersion": "36.0.0",
    "version": "1.0.0",
    "entryPoint": "node_modules/expo/AppEntry.js",
    "platforms": [
      "ios",
      "android",
      "web"
    ]
  },
  "android": {
    "package": "com.artikgauravfb.fiftybusinessideas",
    "versionCode": 1,
    "permissions":[],
    "icon":"./assets/icon.png",


    "config": {

      "googleMobileAdsAppId": "ca-app-pub-3886326456378130~9716552547"
    }
}
}

Мой android файл манифеста выглядит так: -

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.project1">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

    <!-- OPTIONAL PERMISSIONS, REMOVE WHATEVER YOU DO NOT NEED -->
    <uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
    <uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <!-- <uses-permission android:name="android.permission.USE_FINGERPRINT" /> -->
    <!-- <uses-permission android:name="android.permission.VIBRATE" /> -->
    <!-- <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> -->

    <!-- These require runtime permissions on M -->

    <!-- END OPTIONAL PERMISSIONS -->

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher_square"
      android:roundIcon="@mipmap/ic_launcher"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
      <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-3886326456378130~9716552547"/>
      <meta-data android:name="com.google.android.gms.ads.AD_MANAGER_APP" android:value="true" />
    </application>

</manifest>
...