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

build.gradle:实施项目(‘:react本机-sqlite存储’)
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
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
{
"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/"
]
}
}我怎么才能解决我的问题
发布于 2020-02-06 14:23:53
我的android/设置.等级是
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中没有任何改变
而且起作用了!
https://stackoverflow.com/questions/58196399
复制相似问题