Issue with psycopg2 SSL Support when Converting Kivy App to APK

75 Views Asked by At

I've developed a Python Kivy app that runs fine on Windows. To convert it into an APK file for mobile devices, I'm using python-for-android with a GitHub workflow. However, attempting to launch the app on a mobile device results in a crash after a few seconds. Upon inspecting the logs with logcat, I discovered the following error:

psycopg2.OperationalError: sslmode value "verify full" invalid when SSL support is not compiled in.

It appears that the psycopg2 package lacks SSL support. Here are the provided requirements during the building process:

--requirements

python3==3.7.6
hostpython3==3.7.6
android
openssl,pyopenssl
httplib2,postgres
setuptools
Cython==0.29.10
sdl2_ttf==2.0.15
pillow
certifi
typing
typing_extensions
sh
pyjnius
backports.zoneinfo
psycopg2==2.9.5
kivy==2.0.0
kivymd==1.0.1

I tried to add openssl, pyopenssl, httplib2 and certify to the requirements. Also I added sudo apt-get install libssl-dev to the github workflow. It didn't resolve the problem.

Before I create the apk I install the following on the Ubuntu machine:

        run: |
          [[ $- == *i* ]] && stty -ixon
          sudo dpkg --add-architecture i386
          sudo apt-get update
          sudo apt-get install -y build-essential ccache git zlib1g-dev python3-dev libncurses5:i386 libstdc++6:i386 zlib1g:i386 openjdk-8-jdk unzip ant ccache autoconf libtool libssl-dev
          sudo apt-get install libpq-dev
          sudo apt-get install openssl
          sudo apt-get install libssl-dev
          python3 -m pip install cython
          python3 -m pip install Cython==0.29.10
          python3 -m pip install kivy==2.0.0
          python3 -m pip install postgres
          python3 -m pip install psycopg2==2.9.5
          python3 -m pip install python-for-android
        shell: bash
0

There are 0 best solutions below