question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[react-native]After adding Sqlite to the project, Error occurs

See original GitHub issue

capture42

My React Native Project configuration is

{ "name": "AwesomeProject", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest" }, "dependencies": { "react": "16.5.0", "react-native": "0.57.0", "react-native-sqlite-storage": "^3.3.6" }, "devDependencies": { "babel-jest": "23.6.0", "jest": "23.6.0", "metro-react-native-babel-preset": "^0.45.0", "react-test-renderer": "16.5.0" }, "jest": { "preset": "react-native" } }

I am Writing Down What Instructions I followed, please Try to spot where I am wrong

In setting.gradle

rootProject.name = 'AwesomeProject'

include ':react-native-sqlite-storage' project(':react-native-sqlite-storage').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sqlite-storage/src/android')

include ':app’ `

In Android/app/build.gradle

dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" implementation "com.facebook.react:react-native:+" // From node_modules compile project(':react-native-sqlite-storage') }

In MainApllication.java

import org.pgsqlite.SQLitePluginPackage;

@Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new SQLitePluginPackage(), new MainReactPackage() ); }

Thankyou for helping Me P.s :- Sorry of My Bad English

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
agatheLGcommented, Sep 9, 2019

Hi, I had a lot of dependencies errors after trying to install react-native-sqlite-storage and i solved it by changing the path in the settings.gradle : I replace project(‘:react-native-sqlite-storage’).projectDir = new File(rootProject.projectDir, ‘…/node_modules/react-native-sqlite-storage/src/android’) by project(‘:react-native-sqlite-storage’).projectDir = new File(rootProject.projectDir, ‘…/node_modules/react-native-sqlite-storage/platforms/android’)

Another thing was that I didn’t put anything in the mainApplication file, I din’t add any package, which gives me this : @Override protected List<ReactPackage> getPackages() { @SuppressWarnings(“UnnecessaryLocalVariable”) List<ReactPackage> packages = new PackageList(this).getPackages(); // Packages that cannot be autolinked yet can be added manually here, for example: // packages.add(new MyReactNativePackage()); return packages; }

I hope it helps

3reactions
spruce-brucecommented, Dec 11, 2018

@tonycapone The PR I submitted fixed the issue for me. For now I’ve got "react-native-sqlite-storage": "git://github.com:spruce-bruce/react-native-sqlite-storage.git#resolve-gradle-dep", in my package.json and that allows my builds to succeed. Once my PR is merged I’ll be able to switch back to the npm module

Read more comments on GitHub >

github_iconTop Results From Across the Web

Result and Error Codes - SQLite
The SQLITE_PROTOCOL error is currently only returned when using WAL mode and attempting to start a new transaction.
Read more >
Sqlite3, OperationalError: unable to open database file
On unix I got that error when using the ~ shortcut for the user directory. ... The reason is that SQLite will create...
Read more >
Save data using SQLite - Android Developers
Saving data to a database is ideal for repeating or structured data, such as contact information. This page assumes that you are familiar ......
Read more >
Using SQLite in a C# Application - CodeGuru
SQLite is a small, fast, and embeddable open source file system-based SQL database. ... Open Visual Studio, select new project, and, in Visual...
Read more >
SQLite database connector (Reference) - Prisma
Rounding errors on big numbers. SQLite is a loosely-typed database. If your Schema has a field of type Int , then Prisma prevents...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found