Skip to content
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

Crash with Crosswalk on x86 64bit #336

Open
enricodeleo opened this issue Sep 7, 2015 · 30 comments
Open

Crash with Crosswalk on x86 64bit #336

enricodeleo opened this issue Sep 7, 2015 · 30 comments

Comments

@enricodeleo
Copy link

As other users pointed out already this plugin causes a crash on 64 bit architectures if run under Crosswalk (tested on various versions, canary included).

This plugin also caused the apk to be generated as multi architecture instead of per architecture.

With the very same environment, switching just back to com.brodysoft.sqlitePlugin 1.0.4 resolved these issues.
The problem is definitely something that is on 0.7.x. Hope this feedback helps.

@brodycj
Copy link
Contributor

brodycj commented Sep 7, 2015

The workaround is to include androidDatabaseImplementation: 2 in your window.sqlitePlugin.openDatabase options. This will be documented in README.md.

@brodycj
Copy link
Contributor

brodycj commented Sep 7, 2015

And thanks for the feedback!

@enricodeleo
Copy link
Author

@brodybits thank you, I already tried androidDatabaseImplementation: 2 but it crashes anyway on my Samsung Galaxy s6 Edge with Android 5.1.1

@brodycj
Copy link
Contributor

brodycj commented Sep 7, 2015

Can you paste the crash log?

Also, IIRC there are two ways to use Crosswalk: either use Crosswalk to create your Cordova project or add Crosswalk as a plugin. It helped some people earlier this year to add Crosswalk as a plugin.

@hanthomas
Copy link

I found that 0.7.10 always crashes when used with Crosswalk (I'm using Crosswalk as a plugin). With 0.7.7, it works fine, but only if you use androidDatabaseImplementation: 2.

@brodycj
Copy link
Contributor

brodycj commented Sep 7, 2015

Try removing sqlite-native-driver.jar from your libs directory, it has caused problems for others. Then you have to use androidDatabaseImplementation: 2.

@hanthomas
Copy link

Thanks @brodybits. That did the trick. BTW, @enricodeleo, I tried this on Samsung Galaxy S6 Edge (via Testdroid), and it worked fine for me.

@enricodeleo
Copy link
Author

@hanthomas I tried on a physical device. With the former configuration (latest version of crosswalk as plugin and cordova-sqlite-storage to 0.7.10) I got an error in /lib. Extracting the apk with unzip I find a unique file per architecture that is libsqlc-native-driver.so. Don't know if this information gives any help...

@brodycj
Copy link
Contributor

brodycj commented Sep 7, 2015

sqlite-native-driver.jar comes with the unique file per architecture in /lib, since it worked for me when I tested on my own device. It has caused problems and I will get rid of that JAR very soon. Please remove it from your libs if you are using Crosswalk.

@hanthomas
Copy link

@enricodeleo Here's what I did:

  1. Removed reference to sqlite-native-driver.jar from plugins/io.litehelpers.cordova.sqlite/plugin.xml
  2. Deleted plugins/io.litehelpers.cordova.sqlite/src/android/libs/sqlite-native-driver.jar file
  3. Deleted platforms/android/libs/sqlite-native-driver.jar file.

This removed any reference or copy of the JAR that's been causing problems. Then, I built the app, which then worked properly on all my Android devices (at least the ones I possess and those that I have access to in Testdroid).

@brodycj
Copy link
Contributor

brodycj commented Sep 11, 2015

I just updated the project to distribute the native Android library files individually. You may not have to include androidDatabaseImplementation: 2 in your openDatabase options anymore.

@enricodeleo
Copy link
Author

@brodybits Great! Thank you!

@hanthomas
Copy link

@brodybits Cool deal!

@mreinhardt24
Copy link

@brodybits the problem still exists if you build only one apk for all devices (ext.cdvBuildMultipleApks = null;). Is there any solution to make this work with only one build.apk?

@brodycj
Copy link
Contributor

brodycj commented Oct 2, 2015

@EpoX44 can you do me a favor and run the tree command (or otherwise list the contents) of your Android project's libs?

@mreinhardt24
Copy link

./platforms/android/libs/
├── arm64-v8a
│   └── libsqlite4java-android-aarch64.so
├── armeabi
│   └── libsqlite4java-android-armv5tejl.so
├── armeabi-v7a
│   └── libsqlite4java-android-armv7l.so
├── sqlite4java.jar
├── x86
│   └── libsqlite4java-android-i686.so
└── x86_64
└── libsqlite4java-android-x86_64.so

This is in the libs folder.

@brodycj
Copy link
Contributor

brodycj commented Oct 2, 2015

Hmm, it does not show me the native libraries from Crosswalk. It was reported that you will have better luck using the cordova-crosswalk plugin instead of the Crosswalk-cordova project.

@mreinhardt24
Copy link

I use the cordova-crosswalk-webview plugin from https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview

@brodycj
Copy link
Contributor

brodycj commented Oct 2, 2015

Also do you include androidDatabaseImplementation: 2 in your openDatabase options? It may still be necessary.

@mreinhardt24
Copy link

Yeah I include that.

I also have to say that the app doesn't crash directly. The problem is that if I open it I get the message that the Crosswalk Project Service is not found and that I have to download it from the Appstore. But I set the xwalkMode to embedded and the size of the app on the device shows me that it is embedded.
With the fixes in this thread the app starts as usual without any problems.
Only if I build one apk for all devices it doesn't work and the message appears again.

@mreinhardt24
Copy link

Is there no solution for my problem?

@jpike88
Copy link

jpike88 commented Feb 29, 2016

This is a major issue and should be given priority attention.

@CookieCookson
Copy link

@EpoX44 @jpike88 @brodybits:
I've been having the same issue with sister plugin cordova-sqlite-evfree 0.8.2 and cordova-plugin-crosswalk-webview 1.5.0, and managed to fix the above issue by doing the following (into a single APK):

A. Removed from plugin.xml:

<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="libs/arm64-v8a"/>

B. Added to my openDatabase calls in javascript:

androidDatabaseImplementation: 2

C. Deleted the folders platforms/android/libs/x86_64/ and platforms/android/libs/arm64-v8a/
D. Deleted the folder platforms/build/ to make sure it re-creates everything

I hope this helps, the 64 bit support in Crosswalk isn't quite there yet at the time of writing. It is in the plugin but only spits out EITHER a 32-bit variant or 64-bit variant. When it does both into one APK, the removed files above may need to be re-included.

CookieCookson referenced this issue in CookieCookson/Cordova-sqlite-enterprise-free Apr 15, 2016
@brodycj
Copy link
Contributor

brodycj commented Apr 15, 2016

Thanks @CookieCookson. I will publish a version without the native Android libs when I get a chance.

Also a gentle reminder that if you publish an app using the cordova-sqlite-evfree plugin you are obligated to either purchase a commercial license or offer the source code under the GPL.

The commercial license is available under the following options:

  • Use in a single app under the same license as Cordova-sqlite-storage and cordova-sqlite-ext for (US) $500 discounted to $300 until the end of June 2016
  • Use in unlimited apps by an individual developer or single company for (US) $3000 discounted to $1800 until the end of June 2016

Contact sales@litehelpers.net

@CookieCookson
Copy link

Cool beans. Thanks for the heads up on the licence, turns out I only need to use cordova-sqlite-ext so won't be using it on a published app.

@jpike88
Copy link

jpike88 commented Apr 16, 2016

I found a workaround.

If you build it with all builds of arm32, arm64 and x86 crosswalk present, it will work fine.

@brodycj
Copy link
Contributor

brodycj commented Apr 28, 2016

This will be documented when I get a chance.

May be related to: #247

@sahildaga95
Copy link

sahildaga95 commented May 19, 2017

@brodybits - This is issue occurs even without Crosswalk. I have a Samsung Galaxy S6 edge device which crashed earlier but the workaround above given by @CookieCookson fixed it.
I am developing Application in Ionic 3.

@brodycj
Copy link
Contributor

brodycj commented Feb 11, 2018

From #752 (closing as a duplicate):

Hi guys,

I have the following problem when I start a new Cordova project and add crosswalk with the following parameters:

"cordova-plugin-crosswalk-webview": {
                "XWALK_MULTIPLEAPK": "false",
                "XWALK_VERSION": "23+",
                "XWALK_LITEVERSION": "xwalk_core_library_canary:17+",
                "XWALK_COMMANDLINE": "--disable-pull-to-refresh-effect",
                "XWALK_MODE": "embedded"
            },

and add the sqlite plugin and try to start the app on a x64 cpu device i get the following Message:
image

i hope someone can help

could be related to #336

https://github.com/danielehrhardt/sqlite-cordova-error

(I noticed the same question at crosswalk-project/cordova-plugin-crosswalk-webview#202)

Here is the recommended workaround:

  • remove reference to sqlite-native-driver.jar (JAR with NDK library objects) from plugin.xml as follows:
diff --git a/plugin.xml b/plugin.xml
index f813a4d..47f3719 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -35,8 +35,6 @@
 
         <!-- Android-sqlite-connector [jar]: -->
         <lib-file src="node_modules/cordova-sqlite-storage-dependencies/libs/sqlite-connector.jar" />
-        <!-- Android-sqlite-connector native driver [native libs in jar]: -->
-        <lib-file src="node_modules/cordova-sqlite-storage-dependencies/libs/sqlite-native-driver.jar" />
     </platform>
 
     <!-- iOS -->
  • as described above: include androidDatabaseImplementation: 2 in your window.sqlitePlugin.openDatabase options.

I will not promise when I will get a chance to investigate this one within the free support program due to my existing backlog. For high-priority support needs please contact sales@litehelpers.net for more information.

patrickbussmann added a commit to bussmann-it/Cordova-sqlite-storage that referenced this issue Feb 11, 2018
@patrickbussmann
Copy link

Thank you very much @brodybits for this workaround. 🎉
Will it have some negative effects if we not using this sqlite-native-driver.jar (JAR with NDK library objects)?

At the moment our application is up and running fine. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants