capacitor-community / sqlite

⚡Capacitor plugin for native & electron SQLite databases.
MIT License
506 stars 121 forks source link

Where do I begin? #69

Closed cparkinsonMYCM closed 3 years ago

cparkinsonMYCM commented 3 years ago

Describe the bug Just can't get started with this...

Nothing I do will put the package into my android project. npx cap sync recognises the plugin is there and then just leaves it at that... I get:

√ Updating Android plugins in 11.17ms
  Found 1 Capacitor plugin for android:
    @capacitor-community/sqlite (2.9.6)
√ update android in 61.12ms
Sync finished in 18.195s

but when I put import com.getcapacitor.community.database.sqlite.CapacitorSQLite; in my MainActivity.java I get "Cannot resolve symbol 'community'"

I assume part of the sync and/or copy is meant to put the files in the android project, because if I manually copy the community folder into the android project (at node_modules\@capacitor\android\capacitor\src\main\java\com\getcapacitor) I then get "package androidx.sqlite.db does not exist" in src>main>java>com>getcapacitor>community>database>sqlite>SQLite>Database.java when building the app to test/debug.

And yet the installation instructions say nothing about having to set this up manually, or otherwise.

Also steps here: https://capacitorjs.com/docs/android/troubleshooting do not resolve anything either.

To Reproduce Steps to reproduce the behaviour:

  1. follow instructions in readme.md
  2. I can't get any further...
cparkinsonMYCM commented 3 years ago

Also steps here: https://capacitorjs.com/docs/android/troubleshooting do not resolve anything either.

Or maybe they did?

I don't know what it was that I changed, but after just mindlessly fiddling with folders and things it now doesn't error and finds the package in the node_modules\@capacitor-community folders...

Feel free to close, I guess. I assume it's Capacitor's issue if not Android Studio's...

jepiqueau commented 3 years ago

@cparkinsonMYCM Which version are you using ? 2.4.6, 2.9.6, 3.0.0-beta2 ? Have you tried the application starters? Which Framework ?

jepiqueau commented 3 years ago

@cparkinsonMYCM May be you did not Synchronize the Project with Gradle Files in Android Studio.

cparkinsonMYCM commented 3 years ago

For reference, though I don't think it was fault of the plugin. I'm using 2.9.6, also was an issue with 2.9.5 on Friday before I left for the weekend.

Framework is Ionic/Angular.

At the time Synchronize the Project with Gradle Files wasn't an option, it was disabled. I haven't manually chosen that, so maybe it happened from updating things. I did make sure Gradle and every other tool I could update in Android Studio was updated, and followed the troubleshooting that Capacitor offers. Something in there did it, but I don't know specifically what it was. Likely was just Gradle, I guess, and I think I just need to be more familiar with the pipeline that Android Studio has. Previously I've only used cordova & ionic. Capacitor is still fresh to me.

Thanks for the response, though! Sorry for the distractions.

jepiqueau commented 3 years ago

@cparkinsonMYCM You are welcome, i am glad that it works now. thanks for using the plugin. Hope you will enjoy it in your development. If you find issues do not hesitate to report them. So i close the issue