我想开始一个新的React Native项目,包括SQLite Storagee。
我以前做过,所以我知道它应该工作,但不是今天...
所以我已经初始化了一个新的项目,在这个项目中我按照这个循序渐进的教程(https://www.npmjs.com/package/react-native-sqlite-storage)安装了react-native-sqlite-storage,android部分。
一切都很好,直到我运行我的项目与React原生运行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,但都不起作用。
需要帮助吗
3条答案
按热度按时间roejwanj1#
嘿,我找到了解决方案!只需转到您的设置. gradle文件并更改此行项目(':react-native-sqlite-storage '). projectDir =新文件(rootProject. projectDir,' ../node_modules/react-native-sqlite-storage/src/android ')
添加到此项目(":react本机sqlite-storage").项目目录=新文件(根项目.项目目录,"../节点模块/react本机sqlite-storage/平台/android")
你好!
e5nszbig2#
相同的问题:(无法确定任务“:app:preDebugBuild”的依赖项。
未能解析配置“:app:debugRuntimeClasspath”的所有任务依赖项。未能解析项目:react-native-sqlite-storage。需要者:无法找到项目的匹配配置:react-native-sqlite-storage:所有消耗品配置都没有属性。
okxuctiv3#
React Native还需要Java SE开发工具包(JDK)。我安装了它,然后刚刚重新启动程序,错误就解决了。希望这对你也有效!!问候。