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

sqlite3 not working with android_new #1053

Closed
tito opened this issue May 15, 2017 · 9 comments
Closed

sqlite3 not working with android_new #1053

tito opened this issue May 15, 2017 · 9 comments

Comments

@tito
Copy link
Member

tito commented May 15, 2017

@ngala commented on Fri Jan 13 2017

Before raising the issue, I have tried to refer any old issues with similar problems. Making attempts to work out solutions.

The Kivy App is running fine on the setup(Ubuntu 15.04 VM). The app was basic and did not have any other python libraries. I could successfully create an APK file and the App worked same on Android(Nexus 5x, Nougat 7.1.1) as it did on Ubuntu.

Now when I tried to import sqlite3, it worked fine on Ubuntu but it crashed on the phone. I was getting no module named sqlite3 in my logcat.

On some digging, I referred to kivy/kivy#705
I removed the blacklisted files referring to sqlite3(including both sqlite3/* and lib-dynload/_sqlite3.so) from blacklist.txt and also installed libsqlite3-dev package. The error changed slightly... no module named _sqlite3

Apparently solution in that issue was partially applicable to new toolchain.

I went a step further and deleted .buildozer folder completely so that it would download and install packages in case they are broken.

but that did not resolve the issue...now it is getting compiler error

checking machine type as reported by uname -m... x86_64
checking for --without-gcc... no
checking for arm-eabi-gcc... /usr/bin/ccache arm-linux-androideabi-gcc -DANDROID -mandroid -fomit-frame-pointer --sysroot /home/droid/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm
checking whether the C compiler works... no
configure: error: in `/home/droid/andr/.buildozer/android/platform/build/build/other_builds/python2-sqlite3/armeabi-v7a/python2':
configure: error: C compiler cannot create executables
See `config.log' for more details

here's the complete file for buildozer debug output (http://pastebin.com/ANuYTu8R) and config.log(http://pastebin.com/maWgbBpw)

The apps created without sqlite3 are still working fine on both Ubuntu and Android.


@ngala commented on Tue Feb 28 2017

Hi...any update in this?


@tito commented on Mon May 15 2017

I think that's an issue with python-for-android directly. The recipe build order put sqlite3 after compiling Python, but it should been done before. I'm moving it.

@germn
Copy link
Contributor

germn commented May 15, 2017

Duplicate #977

Solution is to replace hostpython2 with python2 in requirements.

@ngala
Copy link

ngala commented May 28, 2017

I am already using hostpython2. Please refer to line 60 in buildozer debug output (http://pastebin.com/ANuYTu8R). It suggests that hostpython2 is already being used.

Please let me know any other details are required for the resolution.

@germn
Copy link
Contributor

germn commented May 28, 2017

@ngala

I am already using hostpython2

And you need to replace it with python2 to get sqlite3 working.

Your requirements should be: python2, sqlite3, kivy

@ngala
Copy link

ngala commented Jun 1, 2017

That doesn't work either. By using python2, I was succesfuly able to create apk. However, I got runtime error while importing sqlite3.

For this specific issue, I created a small app for testing sqlite3 - https://pastebin.com/spZqk6pb

as per app, it will only import sqlite3 when we click on button. On clicking we get following traceback output after using python2, sqlite3, kivy in requirement:

06-01 16:15:24.762  4648  4772 I python  :  Traceback (most recent call last):
06-01 16:15:24.763  4648  4772 I python  :    File "/home/droid/andr/.buildozer/android/app/main.py", line 25, in imp_sqlite
06-01 16:15:24.763  4648  4772 I python  :    File "/home/droid/andr/.buildozer/android/platform/build/build/other_builds/python2/armeabi-v7a/python2/python-install/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
06-01 16:15:24.764  4648  4772 I python  :    File "/home/droid/andr/.buildozer/android/platform/build/build/other_builds/python2/armeabi-v7a/python2/python-install/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
06-01 16:15:24.765  4648  4772 I python  :  ImportError: No module named _sqlite3

It works on Ubuntu when i run "python2 main.py"

@chbeltz
Copy link

chbeltz commented Jun 4, 2017

Could you post your buildozer.spec file? Or at least relevant parts of it?

@ngala
Copy link

ngala commented Jun 5, 2017

buildozer.spec - https://pastebin.com/UqvcKhuJ

*updated with correct link

@chbeltz
Copy link

chbeltz commented Jun 5, 2017

Try actively whitelisting files required for sqlite3 in your buildozer.spec, like so:
android.p4a_whitelist = sqlite3/*,lib-dynload/_sqlite3.so

That, along with adding sqlite3 to the requirements and running buildozer android_new clean before my next build fixed all issues I had with sqlite3 (and sqlalchemy).

@ngala
Copy link

ngala commented Jun 18, 2017

I am successfully able to import sqlite3 after performing the above 2 steps.

Thanks it works now.

@inclement
Copy link
Member

sqlite3 is currently working well in the master branch.

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

No branches or pull requests

5 participants