-
Notifications
You must be signed in to change notification settings - Fork 716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to work with cordova-android@7.0.0 #729
Comments
Marked as a bug, thanks for reporting. Hoping to resolve this in the near future. Until then P.S. The fundamental issue is a problem with adding JAR and NDK library files due to wrong plugin.xml tag used. |
Awesome, thanks! |
@NeoLSN that looks right to me. For reference: https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#lib-file I will investigate further when I get a chance. I wonder if it would work to use arch="*" to mean use library regardless of emulator or device. Thanks for the hint! |
Looks like there is a better solution at https://stackoverflow.com/questions/34115571/add-external-jar-library-to-build-cordova-plugin-ionic-framework/34129929#34129929: use lib-file element with no arch setting. |
Right now, seems this plugin will change the cordova context when installing it. So after this plugin installed, the other plugins would be install unsuccessfully. |
I do not follow, can you please explain further? |
The installing order of my plugins is like this.
After installing
But if I remove the |
Maybe this issue is from what you mentioned. |
@NeoLSN : "Error: ENOENT: no such file or directory, open '<project_root>/platforms/android/AndroidManifest.xml'"
It will make this error message disappear, but I was not able to get the cordova-sqlite-ext running using cordova-android@7.0.0. It always reports "error: package io.liteglue does not exist". |
@mmp-schmitt Because you are doing wrong thing. What you are doing is just let the 'add plugin' success, but this action also brakes Android project structure. |
@NeoLSN: If this is the wrong thing to do, then what is the right thing to do? |
@mmp-schmitt This issue is trying to figure out a correct way to add this plugin into new Android project via cordova CLI. |
If I would adapt diff --git a/plugin.xml b/plugin.xml
index 0442733..eec9c95 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -34,13 +34,13 @@
<source-file src="src/android/io/sqlc/SQLiteConnectorDatabase.java" target-dir="src/io/sqlc"/>
<!-- Android-sqlite-connector [jar]: -->
- <source-file src="node_modules/cordova-sqlite-storage-dependencies/libs/sqlite-connector.jar" target-dir="libs"/>
+ <lib-file src="node_modules/cordova-sqlite-storage-dependencies/libs/sqlite-connector.jar" />
<!-- Android-sqlite-connector native driver [native libs]: -->
- <source-file src="node_modules/cordova-sqlite-storage-dependencies/libs/arm64-v8a/libsqlc-native-driver.so" target-dir="libs/arm64-v8a"/>
- <source-file src="node_modules/cordova-sqlite-storage-dependencies/libs/armeabi/libsqlc-native-driver.so" target-dir="libs/armeabi"/>
- <source-file src="node_modules/cordova-sqlite-storage-dependencies/libs/armeabi-v7a/libsqlc-native-driver.so" target-dir="libs/armeabi-v7a"/>
- <source-file src="node_modules/cordova-sqlite-storage-dependencies/libs/x86/libsqlc-native-driver.so" target-dir="libs/x86"/>
- <source-file src="node_modules/cordova-sqlite-storage-dependencies/libs/x86_64/libsqlc-native-driver.so" target-dir="libs/x86_64"/>
+ <lib-file src="node_modules/cordova-sqlite-storage-dependencies/libs/arm64-v8a" />
+ <lib-file src="node_modules/cordova-sqlite-storage-dependencies/libs/armeabi" />
+ <lib-file src="node_modules/cordova-sqlite-storage-dependencies/libs/armeabi-v7a" />
+ <lib-file src="node_modules/cordova-sqlite-storage-dependencies/libs/x86" />
+ <lib-file src="node_modules/cordova-sqlite-storage-dependencies/libs/x86_64" />
</platform>
<!-- iOS -->
Brodys-MacBook-Pro:cordova-sqlite-common-dev brodybits$ it still works on cordova-android@6 but NOT on cordova-android@7. I discovered someone made the following change in filionf/cordova-sqlite-legacy@74adc97 to support cordova-android@7 as installed by Cordova 8: diff --git a/plugin.xml b/plugin.xml
index e5cc6f2..f275f6c 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -35,13 +35,13 @@
<source-file src="src/android/io/sqlc/SQLiteConnectorDatabase.java" target-dir="src/io/liteglue"/>
<!-- Android-sqlite-connector [jar]: -->
- <source-file src="src/android/libs/sqlite-connector.jar" target-dir="libs"/>
+ <source-file src="src/android/libs/sqlite-connector.jar" target-dir="app/libs"/>
<!-- Android-sqlite-connector native driver [native libs]: -->
- <source-file src="src/android/libs/arm64-v8a/libsqlc-native-driver.so" target-dir="libs/arm64-v8a"/>
- <source-file src="src/android/libs/armeabi/libsqlc-native-driver.so" target-dir="libs/armeabi"/>
- <source-file src="src/android/libs/armeabi-v7a/libsqlc-native-driver.so" target-dir="libs/armeabi-v7a"/>
- <source-file src="src/android/libs/x86/libsqlc-native-driver.so" target-dir="libs/x86"/>
- <source-file src="src/android/libs/x86_64/libsqlc-native-driver.so" target-dir="libs/x86_64"/>
+ <source-file src="src/android/libs/arm64-v8a/libsqlc-native-driver.so" target-dir="app/libs/arm64-v8a"/>
+ <source-file src="src/android/libs/armeabi/libsqlc-native-driver.so" target-dir="app/libs/armeabi"/>
+ <source-file src="src/android/libs/armeabi-v7a/libsqlc-native-driver.so" target-dir="app/libs/armeabi-v7a"/>
+ <source-file src="src/android/libs/x86/libsqlc-native-driver.so" target-dir="app/libs/x86"/>
+ <source-file src="src/android/libs/x86_64/libsqlc-native-driver.so" target-dir="app/libs/x86_64"/>
</platform>
Will work but would need a major release since it would not work on earlier versions of cordova-android. Best solution is probably to use Gradle. For next major release (#687) the plan is to use builtin sqlite library on Android/iOS/macOS in this plugin version (cordova-sqlite-storage) and to deal with Android NDK library in cordova-sqlite-ext. |
I tried the solution above, but the 'apk' is still missing the libraries 'sqlite-connector.jar' and 'libsqlc-native-driver.so'. I cannot see any folder 'app/libs/' or 'libs' in the 'apk'. |
waiting for this issue to be resolved with android@7, i am able to save data in db, but when i fetch from db , it hangs. :( |
+1 waiting.. |
@brodybits This problems has opened also other issues on other frameworks and plugins, like ionic ionic-team/ionic-plugin-keyboard#304 As mentioned, after installing your plugin we can not install any other plugin. Do you thinkg you can resolve this issue as fast as possible? |
@brodybits
|
I will need 1-2 days to issue a special major release to resolve this issue by dropping use of Android-sqlite-connector / Android-sqlite-native-driver. Windows platform will likely be dropped from cordova-sqlite-storage at the same time as discussed in #687. |
Absolutely and thanks Tom Bell for the response. It took a total of 1-2
long days of trial-and-error to get it now hopefully right.
On Jan 4, 2018 07:26, "Tom Bell" <notifications@github.com> wrote:
Thank you for your work on this @brodybits <https://github.com/brodybits>,
I'll give this a try and upgrade cordova-android to 7.0.0 later. 👍
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#729 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABfNUGF-RfQ8n6dXb4P6WyG355asvtf6ks5tHMNbgaJpZM4Q5Tvj>
.
|
@brodybits just finished testing, and works perfectly! 👍 |
@tombell thanks again for reporting and testing:) |
@brodybits I also tested it, it seems to work on cordova-android@6.4.0, for now I can not test on 7.0.0 because there are other plugins which has also problems with latest version. THX MAN |
@mburger81 absolutely and thanks for the feedback. While I would regard some of the error output to be an issue with the tooling (not clear enough) it is definitely better to avoid this kind of problem in the first place. In case of any further issues with cordova-android@7 please report here or in a new issue. |
Hello, thanks for your work. I updated cordova (with cordova-android@7) today and found this issue creating my app. Should I downgrade cordova? Or could you help me on how to include it using gradle? Thanks |
@Medtrack I already tested and published a solution for this issue. As I stated in a comment above:
In case it does not work for you please give https://github.com/brodybits/cordova-sqlite-storage-starter-app a try. I just updated it to reference the latest version of this plugin and it works for me on Android with Cordova CLI 8 / cordova-android@7.0.0.
Possible but you should not have to do this. You should be able to do
Gradle for Android would be the best solution. I will probably try this on SQLCipher first since they already support Gradle ref: storesafe/cordova-sqlcipher-adapter#64 In case this issue continues to persist for you then I will need some more information to diagnose what may be going wrong. In case you need private or higher priority support please contact sales@litehelpers.net for more information. |
Thank you very much @brodybits Many thanks for your answer. |
@Medtrack I also fixed the SQLCipher plugin version to support cordova-android@7 by referencing AAR (ref: storesafe/cordova-sqlcipher-adapter#64). |
Hi @brodybits, it's been a while but it is working now :-) Thank you very much for your work!!! |
For some reason, this is still not working:
I've tried the cordova-sqlite-storage-starter-app and it adds the platform there without any issues. I'm very confused as to where's the difference. Could it be that other plugins are influencing this? |
Hi @sebastian-zarzycki-es it is possible that other plugins can influence your results, also possible that your Android platform project is really messed up. I would recommend you try the following: First completely remove your Android project (rm -rf ..../platforms/android) and then try your If that doesn't work then I recommend that you start with a clean project and add one plugin at a time until you can determine what does and does not work. |
Yes, my apologies. From that output, it looked like cordova-sqlite-storage was the culprit, where, in fact, it was a plugin right before that - namely, cordova-plugin-youtube-video-player. Removing the plugin fixed the build. |
I have found success overriding the cordova lib check using this hook: https://gist.github.com/joeljeske/68121fa6d643e0937f50458d0172e16e This avoids being blocked by a potentially bad plugin and waiting for them to upgrade. |
Thanks @joeljeske. I am thinking right now this is something that should be fixed on Cordova itself, open to feedback though. |
- Use cordova-sqlite-ext-deps 1.1.0 with SQLite 3.22.0, with Android sqlite-native-driver NDK build in JAR (along with other compile-time option updates) to resolve issue on cordova-android@7 ref: storesafe/cordova-sqlite-storage#729 - SQLITE_DEFAULT_SYNCHRONOUS=3 (EXTRA DURABLE) compile-time setting on all platforms (Android/iOS/macOS/Windows) ref: storesafe/cordova-sqlite-storage#736 - plugin.xml use lib-file for Android sqlite-native-driver NDK build in JAR from cordova-sqlite-ext-deps (1.1.0) to resolve issue on cordova-android@7 (along with other compile-time option updates) ref: storesafe/cordova-sqlite-storage#729 - SQLITE_THREADSAFE=1 for iOS/macOS along with others (Android/Windows) ref: storesafe/cordova-sqlite-storage#754 - Enable FTS5 & JSON1 on all platforms
I'm still having this issue for some reason. Is there something I'm missing? It's happening on a lot of other plugins still, and it's been ~5 months since 7.0 was released |
i'm having the issue aswell with android 7.0, any idea why ? |
After much trial and error, I found the libs path for
I've fixed this in my cordova-plugin-hello-c example plugin and tested it with |
Thanks @dpa99c for the input. Personally I would heavily favor using JAR, or AAR from Mavin, to avoid dependency on the generated directory structure. |
This issue is now locked as resolved on this plugin. In case of further issues with Android NDK libraries I would recommend starting with https://github.com/brodybits/cordova-sqlite-storage-starter-app and adding one plugin at a time to discover which still need to be fixed. I raised apache/cordova-docs#902 to get this documented for other plugins on Cordova itself and would prefer to keep further discussion there. I also raised storesafe/cordova-sqlite-storage-help#60 in case anyone has any questions about Android NDK (*.so) libraries related to this plugin. In case anyone can reproduce an issue with Android NDK libraries on this plugin, with a minimal, complete, and verifiable example (https://stackoverflow.com/help/mcve), then a new issue with the mvce would be appreciated. |
The android platform directory changed structure with 7.0.0, so some things like the
libs/
directory is ending up in the wrong place. Even if I copied the libs into the right directory, there were additional errors of things not being found, when trying to build.The text was updated successfully, but these errors were encountered: