当前位置: 首页 > 知识库问答 >
问题:

无法在React本机项目上安装SQLite

裴昕
2023-03-14

我想启动一个新的React原生项目,包括SQLite Storagee。

我以前已经做过了,所以我知道它应该能用,但今天不行。。。

因此,我启动了一个新项目,在该项目中,我按照本教程的步骤安装了react原生sqlite存储(https://www.npmjs.com/package/react-native-sqlite-storage),android部分。

一切都很好,直到我运行我的项目反应原生运行Android。

这是我的包裹。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存储的不同版本中都尝试过,但都不起作用。

需要帮忙吗

共有2个答案

乐宜民
2023-03-14

同样的问题:(无法确定任务的依赖项:app: preDebugBuild)。

无法解析配置“:app:debugRuntimeClasspath”的所有任务依赖项。无法解析项目:react本机sqlite存储。必需:project:app找不到project:react本机sqlite存储的匹配配置:所有可消费配置都没有属性。

葛承德
2023-03-14

嘿我找到解决办法了!只需转到您的settings.gradle文件并更改此LINE项目(': react-nate-sqlite存储'). project ectDir=new File(rootProject.projectDir,'.../node_modules/react-nate-sqlite存储/src/android')

到这个项目(': react-nate-sqlite存储'). project=new File(rootProject.projectDir,'.../node_modules/react-nate-sqlite存储/平台/android')

问候语!

 类似资料:
  • 您好,我遵循了在windows上设置React本机项目的官方文档。我在location中添加了ANDROID_HOME变量作为系统变量 在第二步中,我应该在 “C:\Android\tools\bin\platform tools” 但是Android中没有tools文件夹,我发现SDK下的平台工具就在下面 "C:\用户\AKSHAY\AppData\本地\Android\SDK\平台工具" 现在

  • 朋友们好,我想让我的插件在react native中,我想从我的react native js文件调用我的ios native module函数,下面是我的代码 ios库代码如下 JS文件代码如下 我只想从我的js文件调用简单的函数到ios本机库类,但当我运行上面的代码时,我得到了像TypeError这样的错误:未定义不是一个对象(评估“MyLibManager.find事件”) 知道我该怎么解决

  • 我是新的和开始工作的基于项目,但面临一个问题时安装在项目级别(我使用Ide)。 composer安装--无交互--ansi 使用包信息加载composer存储库 从锁文件安装依赖项(包括需要开发) 没有要安装或更新的内容 生成优化的自动加载文件  过程:- 安装composer和wamp服务器 作曲家创建项目laravel/laravel 和项目创建与此错误和没有供应商文件夹创建 安装larave

  • 我们正在从文件uri安装apk,它工作到Android Pie(9),在Android10移动中它显示“在解析时出现问题”(There was problem while parsing)。我们只在应用程序存储中存储了文件,构建版本为4.4 我已经分享了下面的代码。多谢好处。 清单中的提供程序 Provider_Paths

  • 只是按照facebook.github上的说明进行create-react-native-app首先得到的:react-redux 5.0.6需要react@^0.14.0 || react@^15.0.0-0的对等体....然后我卸载了react-redux,得到了这个... 这里是包.json 错误启动包装机 错误:未安装React native。请在您的项目目录中运行npm install。