![](/img/trans.png)
[英]Why React-Native Couldn't start project on Android connection with Expo?
[英]React Native with Expo fails on Android Emulator - Couldn't find implementation for Permissions Interface
我正在尝试在 Android 模拟器上运行一个 react-native 应用程序,但该应用程序在启动后显示此错误。
我不清楚它是在抱怨 Android 的权限,还是来自声明为依赖于其他 expo 库(如 expo-av 和 expo-image-picker)的 expo 权限。
请你帮帮我好吗?
这是 build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 24
compileSdkVersion = 30
targetSdkVersion = 30
// androidXAnnotation = "1.1.0"
// androidXBrowser = "1.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
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")
}
maven { url 'https://maven.google.com' }
maven { url 'https://www.jitpack.io' }
maven {
// expo-camera bundles a custom com.google.android:cameraview
url "$rootDir/../node_modules/expo-camera/android/maven"
}
google()
jcenter()
}
}
这是依赖项:
{
"name": "Instadating",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"prettier": "prettier --write '*.js' 'src/**/*.js'",
"android": " cd android && ./gradlew clean && cd .. && react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint src/.",
"fixlint": "eslint --fix src/.; exit 0",
"test": "jest"
},
"dependencies": {
"@invertase/react-native-apple-authentication": "^1.1.1",
"@react-native-community/art": "^1.2.0",
"@react-native-community/async-storage": "^1.6.3",
"@react-native-community/geolocation": "^2.0.2",
"@react-native-community/masked-view": "^0.1.10",
"@react-native-firebase/app": "^11.2.0",
"@react-native-firebase/auth": "^11.2.0",
"@react-native-firebase/messaging": "^11.2.0",
"@react-navigation/bottom-tabs": "^5.7.0",
"@react-navigation/compat": "^5.2.0",
"@react-navigation/drawer": "^5.8.5",
"@react-navigation/native": "^5.7.0",
"@react-navigation/stack": "^5.7.0",
"@reduxjs/toolkit": "^1.0.4",
"axios": "^0.19.0",
"base-64": "^0.1.0",
"crypto-js": "^3.1.9-1",
"expo-av": "^9.0.0",
"expo-blur": "^9.0.0",
"expo-camera": "^10.0.0",
"expo-constants": "^10.0.1",
"expo-facebook": "^10.0.0",
"expo-file-system": "^10.0.0",
"expo-firebase-recaptcha": "^1.3.0",
"expo-image-picker": "^10.0.0",
"expo-localization": "^10.0.0",
"expo-location": "^11.0.0",
"firebase": "8.3.2",
"i18n-js": "^3.5.0",
"invert-color": "^2.0.0",
"lodash": "^4.17.21",
"lodash.isequal": "^4.5.0",
"lodash.memoize": "^4.1.2",
"moment": "^2.27.0",
"oauth-1.0a": "^2.2.6",
"react": "17.0.1",
"react-native": "0.64.0",
"react-native-actionsheet": "^2.4.2",
"react-native-app-intro-slider": "^4.0.4",
"react-native-appearance": "^0.3.4",
"react-native-autogrow-textinput": "^5.4.0",
"react-native-button": "^3.0.1",
"react-native-confirmation-code-field": "^6.5.0",
"react-native-create-thumbnail": "^1.2.2",
"react-native-deck-swiper": "^2.0.5",
"react-native-dialog-input": "^1.0.8",
"react-native-elements": "^2.3.1",
"react-native-fast-image": "^8.3.2",
"react-native-ffmpeg": "^0.5.0",
"react-native-gesture-handler": "^1.7.0",
"react-native-get-random-values": "^1.4.0",
"react-native-iap": "^6.0.2",
"react-native-image-crop-picker": "^0.33.2",
"react-native-image-picker": "^2.3.3",
"react-native-image-progress": "^1.1.1",
"react-native-image-resizer": "^1.2.6",
"react-native-image-view": "^2.1.9",
"react-native-indicators": "^0.17.0",
"react-native-iphone-x-helper": "^1.2.1",
"react-native-keyboard-aware-scroll-view": "^0.9.2",
"react-native-keyboard-aware-view": "^0.0.14",
"react-native-keyboard-tracking-view": "^5.7.0",
"react-native-localize": "^1.3.1",
"react-native-modal": "^11.4.0",
"react-native-modal-patch": "https://github.com/HarvestProfit/react-native-modal-patch.git",
"react-native-modalbox": "^2.0.0",
"react-native-phone-input": "^0.2.4",
"react-native-progress": "^4.1.2",
"react-native-reanimated": "^1.13.0",
"react-native-safe-area-context": "^3.1.7",
"react-native-screens": "^2.10.1",
"react-native-scrollable-tab-view": "^0.10.0",
"react-native-search-bar": "^3.5.1",
"react-native-search-box": "^0.0.19",
"react-native-slider": "^0.11.0",
"react-native-splash-screen": "^3.2.0",
"react-native-swiper": "^1.6.0",
"react-native-ui-lib": "^5.19.0",
"react-native-unimodules": "^0.11.0",
"react-native-vector-icons": "^7.0.0",
"react-native-video": "^5.1.0-alpha8",
"react-native-view-overflow": "^0.0.5",
"react-native-webview": "^10.8.3",
"react-redux": "^7.1.1",
"redux": "^4.0.4",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"remote-redux-devtools": "^0.5.16",
"uuidv4": "^5.0.1"
},
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/runtime": "^7.8.4",
"@react-native-community/eslint-config": "^1.1.0",
"babel-eslint": "^10.0.3",
"babel-jest": "^25.1.0",
"eslint": "^4.3.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-idiomatic": "^4.0.0",
"eslint-config-prettier": "^4.3.0",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-react": "^7.13.0",
"eslint-plugin-react-native": "^3.7.0",
"jest": "^25.1.0",
"jetifier": "^1.6.6",
"metro-react-native-babel-preset": "^0.59.0",
"prettier": "2.0.4",
"react-test-renderer": "16.13.1"
},
"jest": {
"preset": "react-native"
}
}
提前致谢:)
安装expo-image-picker
版本10.*
后我遇到了同样的问题,降级到版本9.*
帮助我修复了它。
您甚至必须将build.gradle
更新为
buildscript {
ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
}
...
这很可能是由您使用的expo-permissions
版本引起的。 我在运行 npm-check-updates 并更新了expo-permissions
和expo-image-picker
picker 后遇到了这个问题。
当我回到这两个版本(左栏)时,一切都恢复正常了:
expo-image-picker ^10.1.4 → ^10.2.2
expo-permissions ^12.0.1 → ^12.1.1
我有类似的问题。 我认为您在运行项目之前错过了“expo install”(链接 expo 并运行模块)项目。
你可以试试: npm install -> expo install -> npx react-native run-android
。
如果还是不行,你可以试试npm start -- --reset-cache
清理缓存以便运行运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.