首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ReactNative :本机模块SQLite试图重写SQLitePlugin.check getPackage()方法

ReactNative :本机模块SQLite试图重写SQLitePlugin.check getPackage()方法
EN

Stack Overflow用户
提问于 2019-10-02 06:43:43
回答 1查看 496关注 0票数 1

我有一个正常工作的Android react本地应用程序( app本机v0.60.5 )。我尝试在我的应用程序中使用Sqlite存储,但是显示了这个错误。

build.gradle:实施项目(‘:react本机-sqlite存储’)

代码语言:javascript
复制
 MainApplication.js file
    import org.pgsqlite.SQLitePluginPackage;
    @Override
        protected List<ReactPackage> getPackages() {
          @SuppressWarnings("UnnecessaryLocalVariable")
          List<ReactPackage> packages = new PackageList(this).getPackages();
           packages.add(new SQLitePluginPackage());
           return packages;
        } 

Setting.gradle

代码语言:javascript
复制
include ':react-native-sqlite-storage'
project(':react-native-sqlite-storage').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sqlite-storage/src/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app' 

package.json

代码语言:javascript
复制
{
  "name": "AfblSellsApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "axios": "^0.19.0",
    "react": "16.8.6",
    "react-native": "0.60.5",
    "react-native-elements": "^1.2.0",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-magic-move": "^0.6.6",
    "react-native-modal": "^11.4.0",
    "react-native-numeric-input": "^1.8.3",
    "react-native-router-flux": "^4.0.6",
    "react-native-shadow": "^1.2.2",
    "react-native-sqlite-storage": "^4.1.0",
    "react-native-svg": "^9.9.4",
    "react-native-svg-uri": "^1.2.3",
    "react-native-vector-icons": "^6.6.0",
    "react-redux": "^7.1.1",
    "redux": "^4.0.4",
    "redux-thunk": "^2.3.0"
  },
  "devDependencies": {
    "@babel/core": "^7.6.0",
    "@babel/runtime": "^7.6.0",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.4.0",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.56.0",
    "react-test-renderer": "16.8.6"
  },
  "jest": {
    "preset": "react-native"
  },
  "rnpm": {
    "assets": [
      "./assets/fonts/"
    ]
  }
}

我怎么才能解决我的问题

EN

回答 1

Stack Overflow用户

发布于 2020-02-06 14:23:53

我的android/设置.等级是

代码语言:javascript
复制
rootProject.name = 'Awesomeproject'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':react-native-sqlite-storage'
project(':react-native-sqlite-storage').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sqlite-storage/platforms/android')
include ':app'

而且在android\app\src\main\java\com\awesomeproject\MainApplication.java中没有任何改变

而且起作用了!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58196399

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档