バンドルを開こうとしましたが、Androidが実行されている場合、次のメッセージが表示されます
2020-01-05 23:15:45.366 26210-26210/com.note.principal W/.note.principa:隠しフィールドLandroid/view/View;-> mAccessibilityDelegate:Landroid/view/View $ AccessibilityDelegate;へのアクセス(ライトグレーリスト、反射)2020-01-05 23:15:45.470 26210-26242/com.note.principal E/ReactNativeJS:Invariant Violation:requireNativeComponent: "RNCSafeAreaView" was not found in the UIManager。
This error is located at: in RNCSafeAreaView in Unknown in Unknown in n in Unknown in Unknown in C in P in u in RCTView in RCTView in h 2020-01-05 23:15:45.494 26210-26242/com.note.principal E/ReactNativeJS: Invariant Violation: requireNativeComponent:
「RNCSafeAreaView」がUIManagerに見つかりませんでした。
This error is located at: in P in u in RCTView in RCTView in h 2020-01-05 23:15:45.502 26210-26242/com.note.principal E/ReactNativeJS: Invariant Violation: requireNativeComponent:
「RNCSafeAreaView」がUIManagerに見つかりませんでした。
This error is located at: in P in u in RCTView in RCTView in h 2020-01-05 23:15:45.794 26210-26244/com.note.principal E/unknown:ReactNative: Invariant Violation: requireNativeComponent:
「RNCSafeAreaView」がUIManagerに見つかりませんでした。
This error is located at: in RNCSafeAreaView in Unknown in Unknown in n in Unknown in Unknown in C in P in u in RCTView in RCTView in h, stack: exports@175:1634 get@163:682 Al@89:70673 Ml@89:70108 Ul@89:67144 Ul@-1 Pl@89:65839 Pl@-1 <unknown>@89:25495 unstable_runWithPriority@168:3915 sn@89:25442 cn@89:25377 kl@89:64831 la@89:87813 render@89:90592 exports@342:541 run@334:1305 runApplication@334:2287 value@25:3685 <unknown>@25:841 value@25:2939 value@25:813 value@-1 2020-01-05 23:15:45.832 26210-26244/com.note.principal E/unknown:ReactNative: Invariant Violation: requireNativeComponent:
「RNCSafeAreaView」がUIManagerに見つかりませんでした。
This error is located at: in P in u in RCTView in RCTView in h, stack: exports@175:1634 get@163:682 Al@89:70673 Ml@89:70108 Ul@89:67144 Ul@-1 Pl@89:65839 Pl@-1 <unknown>@89:25495 unstable_runWithPriority@168:3915 sn@89:25442 cn@89:25377 kl@89:64831 la@89:87813 render@89:90592 exports@342:541 run@334:1305 runApplication@334:2287 value@25:3685 <unknown>@25:841 value@25:2939 value@25:813 value@-1 2020-01-05 23:15:45.856 26210-26244/com.note.principal E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules Process: com.note.principal, PID: 26210 com.facebook.react.common.JavascriptException: Invariant Violation: requireNativeComponent: "RNCSafeAreaView" was not found in
uIManager。
This error is located at: in P in u in RCTView in RCTView in h, stack: exports@175:1634 get@163:682 Al@89:70673 Ml@89:70108 Ul@89:67144 Ul@-1 Pl@89:65839 Pl@-1 <unknown>@89:25495 unstable_runWithPriority@168:3915 sn@89:25442 cn@89:25377 kl@89:64831 la@89:87813 render@89:90592 exports@342:541 run@334:1305 runApplication@334:2287 value@25:3685 <unknown>@25:841 value@25:2939 value@25:813 value@-1 at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.Java:71) at Java.lang.reflect.Method.invoke(Native Method) at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.Java:371) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.Java:150) at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) at Android.os.Handler.handleCallback(Handler.Java:873) at Android.os.Handler.dispatchMessage(Handler.Java:99) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.Java:26) at Android.os.Looper.loop(Looper.Java:193) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.Java:225) at Java.lang.Thread.run(Thread.Java:764) 2020-01-05 23:15:45.862 26210-26244/com.note.principal I/Process: Sending signal.
PID:26210 SIG:9
プロジェクトのパッケージは
{
"name": "Notes",
"version": "0.0.1",
"private": true,
"scripts": {
"Android": "react-native run-Android",
"ios": "react-native run-ios",
"start": "react-native start",
"bundle_Android": "react-native bundle --entry-file index.js --platform Android --dev false --bundle-output ./bundles/Android/index.Android.bundle",
"bundle_ios": "react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ./bundles/ios/main.jsbundle",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"@react-native-community/masked-view": "^0.1.5",
"prop-types": "^15.7.2",
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-gesture-handler": "^1.5.3",
"react-native-linear-gradient": "^2.5.6",
"react-native-safe-area-context": "^0.6.2",
"react-navigation": "^4.0.10",
"react-navigation-stack": "^2.0.8"
},
"devDependencies": {
"@babel/core": "^7.7.7",
"@babel/runtime": "^7.7.7",
"@react-native-community/eslint-config": "^0.0.6",
"babel-jest": "^24.9.0",
"eslint": "^6.8.0",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.57.0",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
グラドルのプロジェクト
include ':app'
rootProject.name='Notes'
include ':hermes-engine'
project(':hermes-engine').projectDir = new File(rootProject.projectDir, '../node_modules/hermes-engine/Android/')
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/Android')
include ':react-native-linear-gradient'
project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linear-gradient/Android')
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.Android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/Android"
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-Android/dist")
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
apply plugin: 'com.Android.application'
apply plugin: 'kotlin-Android'
apply plugin: 'kotlin-Android-extensions'
Android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId ""
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-Android-optimize.txt'), 'proguard-rules.pro'
}
}
}
project.ext.react = [
enableHermes: false,
]
def jscFlavor = 'org.webkit:Android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", false)
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.Android.support:appcompat-v7:28.0.0'
implementation 'com.Android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.Android.support.test:runner:1.0.2'
androidTestImplementation 'com.Android.support.test.espresso:espresso-core:3.0.2'
implementation "com.facebook.react:react-native:+"
implementation 'com.Android.support:support-annotations:27.1.1'
implementation project(':react-native-gesture-handler')
implementation project(':react-native-linear-gradient')
if (enableHermes) {
implementation project(':hermes-engine')
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
これは活動のコードです
package com.note
import Android.content.Intent
import Android.net.Uri
import Android.os.Build
import Android.os.Bundle
import Android.provider.Settings
import Android.util.Log
import androidx.appcompat.app.AppCompatActivity
import com.facebook.react.ReactInstanceManager
import com.facebook.react.ReactRootView
import com.facebook.react.common.LifecycleState
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler
import com.facebook.react.Shell.MainReactPackage
import com.facebook.soloader.SoLoader
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage
import com.BV.LinearGradient.LinearGradientPackage
class ReactActivity : AppCompatActivity(), DefaultHardwareBackBtnHandler {
private val OVERLAY_PERMISSION_REQ_CODE = 1
private lateinit var mReactRootView: ReactRootView
private lateinit var mReactInstanceManager: ReactInstanceManager
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
SoLoader.init(this, false)
mReactRootView = ReactRootView(this)
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(application)
.setCurrentActivity(this)
.setApplication(application)
.setBundleAssetName("aaaaaa.Android.bundle")
.addPackage(MainReactPackage())
.addPackage(RNGestureHandlerPackage())
.addPackage(LinearGradientPackage())
.setInitialLifecycleState(LifecycleState.RESUMED)
.build()
// The string here (e.g. "MyReactNativeApp") has to match
// the string in AppRegistry.registerComponent() in index.js
mReactRootView.startReactApplication(mReactInstanceManager, "Notes", null)
setContentView(mReactRootView)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (!Settings.canDrawOverlays(this)) {
val intent = Intent(
Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:$packageName")
)
startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE)
}
}
}
override fun invokeDefaultOnBackPressed() {
super.onBackPressed()
}
override fun onBackPressed() {
if (mReactInstanceManager != null) {
mReactInstanceManager.onBackPressed()
} else {
super.onBackPressed()
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == OVERLAY_PERMISSION_REQ_CODE) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (!Settings.canDrawOverlays(this)) {
// SYSTEM_ALERT_WINDOW permission not granted
}
}
}
mReactInstanceManager?.onActivityResult(this,requestCode, resultCode, data)
}
}
誰かが解決策を知っていますか?
同じ問題がありますが、この問題は解決しました。
npm install -g expo-cli
エキスポを更新
以下は私のために働きました: