我想开始一个新的React Native项目,其中包括SQLite Storagee。
我之前已经做过此事,所以我知道它应该工作,但今天不行...
因此,我已经按照Android的分步教程(https://www.npmjs.com/package/react-native-sqlite-storage)开始了一个新项目,在其中安装了react-native-sqlite-storage。
一切都很好,直到我运行带有react-native run-android的项目。
这是我的package.json文件
{
"name": "pokedex",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"react": "16.8.6",
"react-native": "0.60.5",
"react-native-sqlite-storage": "^4.0.0"
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/runtime": "^7.5.5",
"@react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.2.2",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.8.6"
},
"jest": {
"preset": "react-native"
}
}
这是我终端中的结果。我不明白发生了什么。
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve project :react-native-sqlite-storage.
Required by:
project :app
> Unable to find a matching configuration of project :react-native-sqlite-storage:
- None of the consumable configurations have attributes.
* 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 10s
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 app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve project :react-native-sqlite-storage.
Required by:
project :app
> Unable to find a matching configuration of project :react-native-sqlite-storage:
- None of the consumable configurations have attributes.
* 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 10s
at checkExecSyncError (child_process.js:629:11)
at execFileSync (child_process.js:647:13)
at runOnAllDevices (/home/axel/leclercq.axel@gmail.com/Pokedex/Developpement - AXEL ONLY/V5/pokedex/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:74:39)
at buildAndRun (/home/axel/leclercq.axel@gmail.com/Pokedex/Developpement - AXEL ONLY/V5/pokedex/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
at then.result (/home/axel/leclercq.axel@gmail.com/Pokedex/Developpement - AXEL ONLY/V5/pokedex/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
我已经尝试了各种版本的react-native和sqlite-storage,但是没有用。
需要帮助
答案 0 :(得分:3)
嘿,我找到了解决方案! 只需转到您的settings.gradle文件并进行更改 这条线 project(':react-native-sqlite-storage')。projectDir =新文件(rootProject.projectDir,'../ node_modules / react-native-sqlite-storage / src / android')
对此 project(':react-native-sqlite-storage')。projectDir =新文件(rootProject.projectDir,'../ node_modules / react-native-sqlite-storage / platforms / android')
问候!
答案 1 :(得分:0)
相同的问题:( 无法确定任务':app:preDebugBuild'的依赖关系。
无法解决配置':app:debugRuntimeClasspath'的所有任务依赖关系。 无法解析项目:react-native-sqlite-storage。 要求: 项目:app 找不到项目的匹配配置:react-native-sqlite-storage:所有易用配置都没有属性。