Repository: kivy/python-for-android

Issue:
ValueError: read of closed file after download of psycopg2
### Versions

* Python: 3.7.7
* OS: Manjaro linux, kernel 5.5.11-1
* Buildozer:1.0

### Description

When trying to compile a simple apk, psycopg2 seems to fail during the download.

### buildozer.spec
Command:
```sh
buildozer android debug
```

Spec file:
```
[app]
title = My Application
package.name = psycopg_example
package.domain = com.example
source.dir = .
source.include_exts = py,png,jpg,kv,atlas
version = 0.1
requirements = python3,kivy,psycopg2,
orientation = all
fullscreen = 0
android.permissions = INTERNET
android.arch = arm64-v8a

[buildozer]
log_level = 2
warn_on_root = 1
```

### Logs

<details>
<summary>Build output containing the error</summary>

```
# Check configuration tokens
# Ensure build layout
# Create directory /home/rene/git/gud/aggregator/andtst/.buildozer
# Create directory /home/rene/git/gud/aggregator/andtst/.buildozer/applibs
# Create directory /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform
# Create directory /home/rene/git/gud/aggregator/andtst/.buildozer/android/app
# Check configuration tokens
# Read available permissions from api-versions.xml
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
/bin/sh: dpkg: command not found
# Search for Git (git)
#  -> found at /usr/bin/git
# Search for Cython (cython)
#  -> found at /home/rene/.cache/pypoetry/virtualenvs/andtst-xFjg9C1i-py3.7/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/lib/jvm/java-8-openjdk/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/lib/jvm/java-8-openjdk/jre/bin/keytool
# Install platform
# Run 'git clone -b master --single-branch https://github.com/kivy/python-for-android.git python-for-android'
# Cwd /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform
Cloning into 'python-for-android'...
# Run '/home/rene/.cache/pypoetry/virtualenvs/andtst-xFjg9C1i-py3.7/bin/python3.7 -m pip install -q  \'appdirs\' \'colorama>=0.3.3\' \'jinja2\' \'six\' \'enum34; python_version<"3.4"\' \'sh>=1.10; sys_platform!="nt"\' \'pep517<0.7.0"\' \'pytoml\' \'virtualenv\''
# Cwd None
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
# Apache ANT found at /home/rene/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/rene/.buildozer/android/platform/android-sdk
# Recommended android's NDK version by p4a is: 19b
# Android NDK found at /home/rene/.buildozer/android/platform/android-ndk-r19b
# Installing/updating SDK platform tools if necessary
# Run '/home/rene/.buildozer/android/platform/android-sdk/tools/bin/sdkmanager tools platform-tools'
# Cwd /home/rene/.buildozer/android/platform/android-sdk
Warning: File /home/rene/.android/repositories.cfg could not be loaded.         
[=======================================] 100% Computing updates...             
# Run '/home/rene/.buildozer/android/platform/android-sdk/tools/bin/sdkmanager --update'
# Cwd /home/rene/.buildozer/android/platform/android-sdk
Warning: File /home/rene/.android/repositories.cfg could not be loaded.         
[=======================================] 100% Computing updates...             
# Updating SDK build tools if necessary
# Run '/home/rene/.buildozer/android/platform/android-sdk/tools/bin/sdkmanager --list'
# Cwd /home/rene/.buildozer/android/platform/android-sdk
Warning: File /home/rene/.android/repositories.cfg could not be loaded.         
Installed packages:=====================] 100% Computing updates...             
  Path                   | Version    | Description                    | Location               
  -------                | -------    | -------                        | -------                
  build-tools;30.0.0-rc2 | 30.0.0 rc2 | Android SDK Build-Tools 30-rc2 | build-tools/30.0.0-rc2/
  platform-tools         | 29.0.6     | Android SDK Platform-Tools     | platform-tools/        
  platforms;android-27   | 3          | Android SDK Platform 27        | platforms/android-27/  
  tools                  | 26.1.1     | Android SDK Tools 26.1.1       | tools/                 

Available Packages:
  Path                                                                                     | Version      | Description                                                         
  -------                                                                                  | -------      | -------                                                             
  add-ons;addon-google_apis-google-15                                                      | 3            | Google APIs                                                         
  add-ons;addon-google_apis-google-16                                                      | 4            | Google APIs                                                         
  add-ons;addon-google_apis-google-17                                                      | 4            | Google APIs                                                         
  add-ons;addon-google_apis-google-18                                                      | 4            | Google APIs                                                         
  add-ons;addon-google_apis-google-19                                                      | 20           | Google APIs                                                         
  add-ons;addon-google_apis-google-21                                                      | 1            | Google APIs                                                         
  add-ons;addon-google_apis-google-22                                                      | 1            | Google APIs                                                         
  add-ons;addon-google_apis-google-23                                                      | 1            | Google APIs                                                         
  add-ons;addon-google_apis-google-24                                                      | 1            | Google APIs                                                         
  build-tools;19.1.0                                                                       | 19.1.0       | Android SDK Build-Tools 19.1                                        
  build-tools;20.0.0                                                                       | 20.0.0       | Android SDK Build-Tools 20                                          
  build-tools;21.1.2                                                                       | 21.1.2       | Android SDK Build-Tools 21.1.2                                      
  build-tools;22.0.1                                                                       | 22.0.1       | Android SDK Build-Tools 22.0.1                                      
  build-tools;23.0.1                                                                       | 23.0.1       | Android SDK Build-Tools 23.0.1                                      
  build-tools;23.0.2                                                                       | 23.0.2       | Android SDK Build-Tools 23.0.2                                      
  build-tools;23.0.3                                                                       | 23.0.3       | Android SDK Build-Tools 23.0.3                                      
  build-tools;24.0.0                                                                       | 24.0.0       | Android SDK Build-Tools 24                                          
  build-tools;24.0.1                                                                       | 24.0.1       | Android SDK Build-Tools 24.0.1                                      
  build-tools;24.0.2                                                                       | 24.0.2       | Android SDK Build-Tools 24.0.2                                      
  build-tools;24.0.3                                                                       | 24.0.3       | Android SDK Build-Tools 24.0.3                                      
  build-tools;25.0.0                                                                       | 25.0.0       | Android SDK Build-Tools 25                                          
  build-tools;25.0.1                                                                       | 25.0.1       | Android SDK Build-Tools 25.0.1                                      
  build-tools;25.0.2                                                                       | 25.0.2       | Android SDK Build-Tools 25.0.2                                      
  build-tools;25.0.3                                                                       | 25.0.3       | Android SDK Build-Tools 25.0.3                                      
  build-tools;26.0.0                                                                       | 26.0.0       | Android SDK Build-Tools 26                                          
  build-tools;26.0.1                                                                       | 26.0.1       | Android SDK Build-Tools 26.0.1                                      
  build-tools;26.0.2                                                                       | 26.0.2       | Android SDK Build-Tools 26.0.2                                      
  build-tools;26.0.3                                                                       | 26.0.3       | Android SDK Build-Tools 26.0.3                                      
  build-tools;27.0.0                                                                       | 27.0.0       | Android SDK Build-Tools 27                                          
  build-tools;27.0.1                                                                       | 27.0.1       | Android SDK Build-Tools 27.0.1                                      
  build-tools;27.0.2                                                                       | 27.0.2       | Android SDK Build-Tools 27.0.2                                      
  build-tools;27.0.3                                                                       | 27.0.3       | Android SDK Build-Tools 27.0.3                                      
  build-tools;28.0.0                                                                       | 28.0.0       | Android SDK Build-Tools 28                                          
  build-tools;28.0.1                                                                       | 28.0.1       | Android SDK Build-Tools 28.0.1                                      
  build-tools;28.0.2                                                                       | 28.0.2       | Android SDK Build-Tools 28.0.2                                      
  build-tools;28.0.3                                                                       | 28.0.3       | Android SDK Build-Tools 28.0.3                                      
  build-tools;29.0.0                                                                       | 29.0.0       | Android SDK Build-Tools 29                                          
  build-tools;29.0.1                                                                       | 29.0.1       | Android SDK Build-Tools 29.0.1                                      
  build-tools;29.0.2                                                                       | 29.0.2       | Android SDK Build-Tools 29.0.2                                      
  build-tools;29.0.3                                                                       | 29.0.3       | Android SDK Build-Tools 29.0.3                                      
  build-tools;30.0.0-rc1                                                                   | 30.0.0 rc1   | Android SDK Build-Tools 30-rc1                                      
  build-tools;30.0.0-rc2                                                                   | 30.0.0 rc2   | Android SDK Build-Tools 30-rc2                                      
  cmake;3.10.2.4988404                                                                     | 3.10.2       | CMake 3.10.2.4988404                                                
  cmake;3.6.4111459                                                                        | 3.6.4111459  | CMake 3.6.4111459                                                   
  cmdline-tools;1.0                                                                        | 1.0          | Android SDK Command-line Tools                                      
  cmdline-tools;latest                                                                     | 1.0          | Android SDK Command-line Tools (latest)                             
  docs                                                                                     | 1            | Documentation for Android SDK                                       
  emulator                                                                                 | 30.0.0       | Android Emulator                                                    
  extras;android;gapid;1                                                                   | 1.0.3        | GPU Debugging tools                                                 
  extras;android;gapid;3                                                                   | 3.1.0        | GPU Debugging tools                                                 
  extras;android;m2repository                                                              | 47.0.0       | Android Support Repository                                          
  extras;google;auto                                                                       | 1.1          | Android Auto Desktop Head Unit emulator                             
  extras;google;google_play_services                                                       | 49           | Google Play services                                                
  extras;google;instantapps                                                                | 1.9.0        | Google Play Instant Development SDK                                 
  extras;google;m2repository                                                               | 58           | Google Repository                                                   
  extras;google;market_apk_expansion                                                       | 1            | Google Play APK Expansion library                                   
  extras;google;market_licensing                                                           | 1            | Google Play Licensing Library                                       
  extras;google;simulators                                                                 | 1            | Android Auto API Simulators                                         
  extras;google;webdriver                                                                  | 2            | Google Web Driver                                                   
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0        | 1            | Solver for ConstraintLayout 1.0.0                                   
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-alpha4 | 1            | com.android.support.constraint:constraint-layout-solver:1.0.0-alpha4
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-alpha8 | 1            | Solver for ConstraintLayout 1.0.0-alpha8                            
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta1  | 1            | Solver for ConstraintLayout 1.0.0-beta1                             
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta2  | 1            | Solver for ConstraintLayout 1.0.0-beta2                             
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta3  | 1            | Solver for ConstraintLayout 1.0.0-beta3                             
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta4  | 1            | Solver for ConstraintLayout 1.0.0-beta4                             
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta5  | 1            | Solver for ConstraintLayout 1.0.0-beta5                             
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.1        | 1            | Solver for ConstraintLayout 1.0.1                                   
  extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2        | 1            | Solver for ConstraintLayout 1.0.2                                   
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0               | 1            | ConstraintLayout for Android 1.0.0                                  
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-alpha4        | 1            | com.android.support.constraint:constraint-layout:1.0.0-alpha4       
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-alpha8        | 1            | ConstraintLayout for Android 1.0.0-alpha8                           
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta1         | 1            | ConstraintLayout for Android 1.0.0-beta1                            
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta2         | 1            | ConstraintLayout for Android 1.0.0-beta2                            
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta3         | 1            | ConstraintLayout for Android 1.0.0-beta3                            
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta4         | 1            | ConstraintLayout for Android 1.0.0-beta4                            
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta5         | 1            | ConstraintLayout for Android 1.0.0-beta5                            
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1               | 1            | ConstraintLayout for Android 1.0.1                                  
  extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2               | 1            | ConstraintLayout for Android 1.0.2                                  
  lldb;2.0                                                                                 | 2.0.2558144  | LLDB 2.0                                                            
  lldb;2.1                                                                                 | 2.1.2852477  | LLDB 2.1                                                            
  lldb;2.2                                                                                 | 2.2.3271982  | LLDB 2.2                                                            
  lldb;2.3                                                                                 | 2.3.3614996  | LLDB 2.3                                                            
  lldb;3.0                                                                                 | 3.0.4213617  | LLDB 3.0                                                            
  lldb;3.1                                                                                 | 3.1.4508709  | LLDB 3.1                                                            
  ndk-bundle                                                                               | 21.0.6113669 | NDK                                                                 
  ndk;16.1.4479499                                                                         | 16.1.4479499 | NDK (Side by side) 16.1.4479499                                     
  ndk;17.2.4988734                                                                         | 17.2.4988734 | NDK (Side by side) 17.2.4988734                                     
  ndk;18.1.5063045                                                                         | 18.1.5063045 | NDK (Side by side) 18.1.5063045                                     
  ndk;19.2.5345600                                                                         | 19.2.5345600 | NDK (Side by side) 19.2.5345600                                     
  ndk;20.0.5594570                                                                         | 20.0.5594570 | NDK (Side by side) 20.0.5594570                                     
  ndk;20.1.5948944                                                                         | 20.1.5948944 | NDK (Side by side) 20.1.5948944                                     
  ndk;21.0.6113669                                                                         | 21.0.6113669 | NDK (Side by side) 21.0.6113669                                     
  patcher;v4                                                                               | 1            | SDK Patch Applier v4                                                
  platform-tools                                                                           | 29.0.6       | Android SDK Platform-Tools                                          
  platforms;android-10                                                                     | 2            | Android SDK Platform 10                                             
  platforms;android-11                                                                     | 2            | Android SDK Platform 11                                             
  platforms;android-12                                                                     | 3            | Android SDK Platform 12                                             
  platforms;android-13                                                                     | 1            | Android SDK Platform 13                                             
  platforms;android-14                                                                     | 4            | Android SDK Platform 14                                             
  platforms;android-15                                                                     | 5            | Android SDK Platform 15                                             
  platforms;android-16                                                                     | 5            | Android SDK Platform 16                                             
  platforms;android-17                                                                     | 3            | Android SDK Platform 17                                             
  platforms;android-18                                                                     | 3            | Android SDK Platform 18                                             
  platforms;android-19                                                                     | 4            | Android SDK Platform 19                                             
  platforms;android-20                                                                     | 2            | Android SDK Platform 20                                             
  platforms;android-21                                                                     | 2            | Android SDK Platform 21                                             
  platforms;android-22                                                                     | 2            | Android SDK Platform 22                                             
  platforms;android-23                                                                     | 3            | Android SDK Platform 23                                             
  platforms;android-24                                                                     | 2            | Android SDK Platform 24                                             
  platforms;android-25                                                                     | 3            | Android SDK Platform 25                                             
  platforms;android-26                                                                     | 2            | Android SDK Platform 26                                             
  platforms;android-27                                                                     | 3            | Android SDK Platform 27                                             
  platforms;android-28                                                                     | 6            | Android SDK Platform 28                                             
  platforms;android-29                                                                     | 4            | Android SDK Platform 29                                             
  platforms;android-7                                                                      | 3            | Android SDK Platform 7                                              
  platforms;android-8                                                                      | 3            | Android SDK Platform 8                                              
  platforms;android-9                                                                      | 2            | Android SDK Platform 9                                              
  platforms;android-R                                                                      | 2            | Android SDK Platform R                                              
  sources;android-15                                                                       | 2            | Sources for Android 15                                              
  sources;android-16                                                                       | 2            | Sources for Android 16                                              
  sources;android-17                                                                       | 1            | Sources for Android 17                                              
  sources;android-18                                                                       | 1            | Sources for Android 18                                              
  sources;android-19                                                                       | 2            | Sources for Android 19                                              
  sources;android-20                                                                       | 1            | Sources for Android 20                                              
  sources;android-21                                                                       | 1            | Sources for Android 21                                              
  sources;android-22                                                                       | 1            | Sources for Android 22                                              
  sources;android-23                                                                       | 1            | Sources for Android 23                                              
  sources;android-24                                                                       | 1            | Sources for Android 24                                              
  sources;android-25                                                                       | 1            | Sources for Android 25                                              
  sources;android-26                                                                       | 1            | Sources for Android 26                                              
  sources;android-27                                                                       | 1            | Sources for Android 27                                              
  sources;android-28                                                                       | 1            | Sources for Android 28                                              
  sources;android-29                                                                       | 1            | Sources for Android 29                                              
  system-images;android-10;default;armeabi-v7a                                             | 5            | ARM EABI v7a System Image                                           
  system-images;android-10;default;x86                                                     | 5            | Intel x86 Atom System Image                                         
  system-images;android-10;google_apis;armeabi-v7a                                         | 6            | Google APIs ARM EABI v7a System Image                               
  system-images;android-10;google_apis;x86                                                 | 6            | Google APIs Intel x86 Atom System Image                             
  system-images;android-14;default;armeabi-v7a                                             | 2            | ARM EABI v7a System Image                                           
  system-images;android-15;default;armeabi-v7a                                             | 5            | ARM EABI v7a System Image                                           
  system-images;android-15;default;x86                                                     | 5            | Intel x86 Atom System Image                                         
  system-images;android-15;google_apis;armeabi-v7a                                         | 6            | Google APIs ARM EABI v7a System Image                               
  system-images;android-15;google_apis;x86                                                 | 6            | Google APIs Intel x86 Atom System Image                             
  system-images;android-16;default;armeabi-v7a                                             | 6            | ARM EABI v7a System Image                                           
  system-images;android-16;default;mips                                                    | 1            | MIPS System Image                                                   
  system-images;android-16;default;x86                                                     | 6            | Intel x86 Atom System Image                                         
  system-images;android-16;google_apis;armeabi-v7a                                         | 6            | Google APIs ARM EABI v7a System Image                               
  system-images;android-16;google_apis;x86                                                 | 6            | Google APIs Intel x86 Atom System Image                             
  system-images;android-17;default;armeabi-v7a                                             | 6            | ARM EABI v7a System Image                                           
  system-images;android-17;default;mips                                                    | 1            | MIPS System Image                                                   
  system-images;android-17;default;x86                                                     | 4            | Intel x86 Atom System Image                                         
  system-images;android-17;google_apis;armeabi-v7a                                         | 6            | Google APIs ARM EABI v7a System Image                               
  system-images;android-17;google_apis;x86                                                 | 6            | Google APIs Intel x86 Atom System Image                             
  system-images;android-18;default;armeabi-v7a                                             | 5            | ARM EABI v7a System Image                                           
  system-images;android-18;default;x86                                                     | 4            | Intel x86 Atom System Image                                         
  system-images;android-18;google_apis;armeabi-v7a                                         | 6            | Google APIs ARM EABI v7a System Image                               
  system-images;android-18;google_apis;x86                                                 | 6            | Google APIs Intel x86 Atom System Image                             
  system-images;android-19;default;armeabi-v7a                                             | 5            | ARM EABI v7a System Image                                           
  system-images;android-19;default;x86                                                     | 6            | Intel x86 Atom System Image                                         
  system-images;android-19;google_apis;armeabi-v7a                                         | 38           | Google APIs ARM EABI v7a System Image                               
  system-images;android-19;google_apis;x86                                                 | 38           | Google APIs Intel x86 Atom System Image                             
  system-images;android-21;android-tv;armeabi-v7a                                          | 3            | Android TV ARM EABI v7a System Image                                
  system-images;android-21;android-tv;x86                                                  | 3            | Android TV Intel x86 Atom System Image                              
  system-images;android-21;default;armeabi-v7a                                             | 4            | ARM EABI v7a System Image                                           
  system-images;android-21;default;x86                                                     | 5            | Intel x86 Atom System Image                                         
  system-images;android-21;default;x86_64                                                  | 5            | Intel x86 Atom_64 System Image                                      
  system-images;android-21;google_apis;armeabi-v7a                                         | 30           | Google APIs ARM EABI v7a System Image                               
  system-images;android-21;google_apis;x86                                                 | 30           | Google APIs Intel x86 Atom System Image                             
  system-images;android-21;google_apis;x86_64                                              | 30           | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-22;android-tv;x86                                                  | 3            | Android TV Intel x86 Atom System Image                              
  system-images;android-22;default;armeabi-v7a                                             | 2            | ARM EABI v7a System Image                                           
  system-images;android-22;default;x86                                                     | 6            | Intel x86 Atom System Image                                         
  system-images;android-22;default;x86_64                                                  | 6            | Intel x86 Atom_64 System Image                                      
  system-images;android-22;google_apis;armeabi-v7a                                         | 24           | Google APIs ARM EABI v7a System Image                               
  system-images;android-22;google_apis;x86                                                 | 24           | Google APIs Intel x86 Atom System Image                             
  system-images;android-22;google_apis;x86_64                                              | 24           | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-23;android-tv;armeabi-v7a                                          | 12           | Android TV ARM EABI v7a System Image                                
  system-images;android-23;android-tv;x86                                                  | 19           | Android TV Intel x86 Atom System Image                              
  system-images;android-23;android-wear;armeabi-v7a                                        | 6            | Android Wear ARM EABI v7a System Image                              
  system-images;android-23;android-wear;x86                                                | 6            | Android Wear Intel x86 Atom System Image                            
  system-images;android-23;default;armeabi-v7a                                             | 6            | ARM EABI v7a System Image                                           
  system-images;android-23;default;x86                                                     | 10           | Intel x86 Atom System Image                                         
  system-images;android-23;default;x86_64                                                  | 10           | Intel x86 Atom_64 System Image                                      
  system-images;android-23;google_apis;armeabi-v7a                                         | 31           | Google APIs ARM EABI v7a System Image                               
  system-images;android-23;google_apis;x86                                                 | 31           | Google APIs Intel x86 Atom System Image                             
  system-images;android-23;google_apis;x86_64                                              | 31           | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-24;android-tv;x86                                                  | 20           | Android TV Intel x86 Atom System Image                              
  system-images;android-24;default;arm64-v8a                                               | 7            | ARM 64 v8a System Image                                             
  system-images;android-24;default;armeabi-v7a                                             | 7            | ARM EABI v7a System Image                                           
  system-images;android-24;default;x86                                                     | 8            | Intel x86 Atom System Image                                         
  system-images;android-24;default;x86_64                                                  | 8            | Intel x86 Atom_64 System Image                                      
  system-images;android-24;google_apis;arm64-v8a                                           | 25           | Google APIs ARM 64 v8a System Image                                 
  system-images;android-24;google_apis;armeabi-v7a                                         | 25           | Google APIs ARM EABI v7a System Image                               
  system-images;android-24;google_apis;x86                                                 | 25           | Google APIs Intel x86 Atom System Image                             
  system-images;android-24;google_apis;x86_64                                              | 25           | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-24;google_apis_playstore;x86                                       | 19           | Google Play Intel x86 Atom System Image                             
  system-images;android-25;android-tv;x86                                                  | 14           | Android TV Intel x86 Atom System Image                              
  system-images;android-25;android-wear-cn;armeabi-v7a                                     | 4            | China version of Android Wear ARM EABI v7a System Image             
  system-images;android-25;android-wear-cn;x86                                             | 4            | China version of Android Wear Intel x86 Atom System Image           
  system-images;android-25;android-wear;armeabi-v7a                                        | 3            | Android Wear ARM EABI v7a System Image                              
  system-images;android-25;android-wear;x86                                                | 3            | Android Wear Intel x86 Atom System Image                            
  system-images;android-25;default;x86                                                     | 1            | Intel x86 Atom System Image                                         
  system-images;android-25;default;x86_64                                                  | 1            | Intel x86 Atom_64 System Image                                      
  system-images;android-25;google_apis;arm64-v8a                                           | 16           | Google APIs ARM 64 v8a System Image                                 
  system-images;android-25;google_apis;armeabi-v7a                                         | 16           | Google APIs ARM EABI v7a System Image                               
  system-images;android-25;google_apis;x86                                                 | 16           | Google APIs Intel x86 Atom System Image                             
  system-images;android-25;google_apis;x86_64                                              | 16           | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-25;google_apis_playstore;x86                                       | 9            | Google Play Intel x86 Atom System Image                             
  system-images;android-26;android-tv;x86                                                  | 12           | Android TV Intel x86 Atom System Image                              
  system-images;android-26;android-wear-cn;x86                                             | 4            | China version of Android Wear Intel x86 Atom System Image           
  system-images;android-26;android-wear;x86                                                | 4            | Android Wear Intel x86 Atom System Image                            
  system-images;android-26;default;x86                                                     | 1            | Intel x86 Atom System Image                                         
  system-images;android-26;default;x86_64                                                  | 1            | Intel x86 Atom_64 System Image                                      
  system-images;android-26;google_apis;x86                                                 | 14           | Google APIs Intel x86 Atom System Image                             
  system-images;android-26;google_apis;x86_64                                              | 14           | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-26;google_apis_playstore;x86                                       | 7            | Google Play Intel x86 Atom System Image                             
  system-images;android-27;android-tv;x86                                                  | 7            | Android TV Intel x86 Atom System Image                              
  system-images;android-27;default;x86                                                     | 1            | Intel x86 Atom System Image                                         
  system-images;android-27;default;x86_64                                                  | 1            | Intel x86 Atom_64 System Image                                      
  system-images;android-27;google_apis;x86                                                 | 9            | Google APIs Intel x86 Atom System Image                             
  system-images;android-27;google_apis_playstore;x86                                       | 3            | Google Play Intel x86 Atom System Image                             
  system-images;android-28;android-tv;x86                                                  | 8            | Android TV Intel x86 Atom System Image                              
  system-images;android-28;android-wear-cn;x86                                             | 3            | China version of Wear OS Intel x86 Atom System Image                
  system-images;android-28;android-wear;x86                                                | 3            | Wear OS Intel x86 Atom System Image                                 
  system-images;android-28;default;x86                                                     | 4            | Intel x86 Atom System Image                                         
  system-images;android-28;default;x86_64                                                  | 4            | Intel x86 Atom_64 System Image                                      
  system-images;android-28;google_apis;x86                                                 | 10           | Google APIs Intel x86 Atom System Image                             
  system-images;android-28;google_apis;x86_64                                              | 9            | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-28;google_apis_playstore;x86                                       | 9            | Google Play Intel x86 Atom System Image                             
  system-images;android-28;google_apis_playstore;x86_64                                    | 8            | Google Play Intel x86 Atom_64 System Image                          
  system-images;android-29;default;x86                                                     | 7            | Intel x86 Atom System Image                                         
  system-images;android-29;default;x86_64                                                  | 7            | Intel x86 Atom_64 System Image                                      
  system-images;android-29;google_apis;x86                                                 | 9            | Google APIs Intel x86 Atom System Image                             
  system-images;android-29;google_apis;x86_64                                              | 9            | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-29;google_apis_playstore;x86                                       | 8            | Google Play Intel x86 Atom System Image                             
  system-images;android-29;google_apis_playstore;x86_64                                    | 8            | Google Play Intel x86 Atom_64 System Image                          
  system-images;android-Q;android-tv;x86                                                   | 1            | Android TV Intel x86 Atom System Image                              
  system-images;android-R;google_apis;x86                                                  | 2            | Google APIs Intel x86 Atom System Image                             
  system-images;android-R;google_apis;x86_64                                               | 2            | Google APIs Intel x86 Atom_64 System Image                          
  system-images;android-R;google_apis_playstore;x86                                        | 2            | Google Play Intel x86 Atom System Image                             
  system-images;android-R;google_apis_playstore;x86_64                                     | 2            | Google Play Intel x86 Atom_64 System Image                          

# Check that aidl can be executed
# Search for Aidl
# Run '/home/rene/.buildozer/android/platform/android-sdk/build-tools/30.0.0-rc2/aidl'
# Cwd None
# Downloading platform api target if necessary
# Android packages installation done.
# Check application requirements
# Check garden requirements
# Compile platform
# Run '/home/rene/.cache/pypoetry/virtualenvs/andtst-xFjg9C1i-py3.7/bin/python3.7 -m pythonforandroid.toolchain create --dist_name=flask_example --bootstrap=sdl2 --requirements=python3,kivy,psycopg2, --arch arm64-v8a --copy-libs --color=always --storage-dir="/home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a" --ndk-api=21'
# Cwd /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android
/home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py:85: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp
[INFO]:    Will compile for the following archs: arm64-v8a
[INFO]:    Found Android API target in $ANDROIDAPI: 27
[INFO]:    Available Android APIs are (27)
[INFO]:    Requested API target 27 is available, continuing.
[INFO]:    Found NDK dir in $ANDROIDNDK: /home/rene/.buildozer/android/platform/android-ndk-r19b
[INFO]:    Found NDK version 19b
[INFO]:    Getting NDK API version (i.e. minimum supported API) from user argument
[INFO]:    Found virtualenv at /home/rene/.cache/pypoetry/virtualenvs/andtst-xFjg9C1i-py3.7/bin/virtualenv
[INFO]:    ccache is missing, the build will not be optimized in the future.
[INFO]:    Found the following toolchain versions: ['4.9']
[INFO]:    Picking the latest gcc toolchain, here 4.9
[INFO]:    No existing dists meet the given requirements!
[INFO]:    No dist exists that meets your requirements, so one will be built.
[INFO]:    Found a single valid recipe set: ['', 'hostpython3', 'libffi', 'libpq', 'openssl', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'sqlite3', 'python3', 'sdl2', 'psycopg2', 'setuptools', 'six', 'pyjnius', 'android', 'kivy']
[INFO]:    The selected bootstrap is sdl2
[INFO]:    # Creating dist with sdl2 bootstrap
[INFO]:    Dist will have name flask_example and requirements (python3, kivy, psycopg2, )
[INFO]:    Dist contains the following requirements as recipes: ['hostpython3', 'libffi', 'libpq', 'openssl', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'sqlite3', 'python3', 'sdl2', 'psycopg2', 'setuptools', 'six', 'pyjnius', 'android', 'kivy']
[INFO]:    Dist will also contain modules () installed from pip
[INFO]:    -> directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/build/bootstrap_builds/sdl2-python3
[INFO]:    <- directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android
[INFO]:    Recipe build order is ['hostpython3', 'libffi', 'libpq', 'openssl', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'sqlite3', 'python3', 'sdl2', 'psycopg2', 'setuptools', 'six', 'pyjnius', 'android', 'kivy']
[INFO]:    The requirements () were not found as recipes, they will be installed with pip.
[INFO]:    # Downloading recipes 
[INFO]:    Downloading hostpython3
[INFO]:    -> running mkdir -p /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/hostpython3
[INFO]:    -> directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/hostpython3
[INFO]:    -> running basename https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz
[INFO]:    -> running rm -f .mark-Python-3.7.1.tgz                                                                                                                                                                       
[INFO]:    Downloading hostpython3 from https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz
[INFO]:    -> running touch .mark-Python-3.7.1.tgz
[INFO]:    <- directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android
[INFO]:    Downloading libffi
[INFO]:    -> running mkdir -p /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/libffi
[INFO]:    -> directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/libffi
[INFO]:    -> running basename https://github.com/libffi/libffi/archive/8fa8837.tar.gz
[INFO]:    -> running rm -f .mark-8fa8837.tar.gz                                                                                                                                                                         
[INFO]:    Downloading libffi from https://github.com/libffi/libffi/archive/8fa8837.tar.gz
[INFO]:    -> running touch .mark-8fa8837.tar.gz
[INFO]:    <- directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android
[INFO]:    Downloading libpq
[INFO]:    -> running mkdir -p /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/libpq
[INFO]:    -> directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/libpq
[INFO]:    -> running basename http://ftp.postgresql.org/pub/source/v9.5.3/postgresql-9.5.3.tar.bz2
[INFO]:    -> running rm -f .mark-postgresql-9.5.3.tar.bz2                                                                                                                                                               
[INFO]:    Downloading libpq from http://ftp.postgresql.org/pub/source/v9.5.3/postgresql-9.5.3.tar.bz2
[INFO]:    -> running touch .mark-postgresql-9.5.3.tar.bz2
[INFO]:    <- directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android
[INFO]:    Downloading openssl
[INFO]:    -> running mkdir -p /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/openssl
[INFO]:    -> directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/openssl
[INFO]:    -> running basename https://www.openssl.org/source/openssl-1.1.1.tar.gz
[INFO]:    -> running rm -f .mark-openssl-1.1.1.tar.gz                                                                                                                                                                   
[INFO]:    Downloading openssl from https://www.openssl.org/source/openssl-1.1.1.tar.gz
[INFO]:    -> running touch .mark-openssl-1.1.1.tar.gz
[INFO]:    <- directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android
[INFO]:    Downloading sdl2_image
[INFO]:    -> running mkdir -p /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/sdl2_image
[INFO]:    -> directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/sdl2_image
[INFO]:    -> running basename https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.4.tar.gz
[INFO]:    -> running rm -f .mark-SDL2_image-2.0.4.tar.gz                                                                                                                                                                
[INFO]:    Downloading sdl2_image from https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.4.tar.gz
[INFO]:    -> running touch .mark-SDL2_image-2.0.4.tar.gz
[INFO]:    <- directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android
[INFO]:    Downloading sdl2_mixer
[INFO]:    -> running mkdir -p /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/sdl2_mixer
[INFO]:    -> directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/sdl2_mixer
[INFO]:    -> running basename https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.tar.gz
[INFO]:    -> running rm -f .mark-SDL2_mixer-2.0.4.tar.gz                                                                                                                                                                
[INFO]:    Downloading sdl2_mixer from https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.tar.gz
[INFO]:    -> running touch .mark-SDL2_mixer-2.0.4.tar.gz
[INFO]:    <- directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android
[INFO]:    Downloading sdl2_ttf
[INFO]:    -> running mkdir -p /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/sdl2_ttf
[INFO]:    -> directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/sdl2_ttf
[INFO]:    -> running basename https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.14.tar.gz
[INFO]:    -> running rm -f .mark-SDL2_ttf-2.0.14.tar.gz                                                                                                                                                                 
[INFO]:    Downloading sdl2_ttf from https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.14.tar.gz
[INFO]:    -> running touch .mark-SDL2_ttf-2.0.14.tar.gz
[INFO]:    <- directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android
[INFO]:    Downloading sqlite3
[INFO]:    -> running mkdir -p /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/sqlite3
[INFO]:    -> directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/sqlite3
[INFO]:    -> running basename https://www.sqlite.org/2016/sqlite-amalgamation-3150100.zip
[INFO]:    -> running rm -f .mark-sqlite-amalgamation-3150100.zip                                                                                                                                                        
[INFO]:    Downloading sqlite3 from https://www.sqlite.org/2016/sqlite-amalgamation-3150100.zip
[INFO]:    -> running touch .mark-sqlite-amalgamation-3150100.zip
[INFO]:    <- directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android
[INFO]:    Downloading python3
[INFO]:    -> running mkdir -p /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/python3
[INFO]:    -> directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/python3
[INFO]:    -> running basename https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz
[INFO]:    -> running rm -f .mark-Python-3.7.1.tgz                                                                                                                                                                       
[INFO]:    Downloading python3 from https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tgz
[INFO]:    -> running touch .mark-Python-3.7.1.tgz
[INFO]:    <- directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android
[INFO]:    Downloading sdl2
[INFO]:    -> running mkdir -p /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/sdl2
[INFO]:    -> directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/sdl2
[INFO]:    -> running basename https://www.libsdl.org/release/SDL2-2.0.9.tar.gz
[INFO]:    -> running rm -f .mark-SDL2-2.0.9.tar.gz                                                                                                                                                                      
[INFO]:    Downloading sdl2 from https://www.libsdl.org/release/SDL2-2.0.9.tar.gz
[INFO]:    -> running touch .mark-SDL2-2.0.9.tar.gz
[INFO]:    <- directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android
[INFO]:    Downloading psycopg2
[INFO]:    -> running mkdir -p /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/psycopg2
[INFO]:    -> directory context /home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a/packages/psycopg2
[INFO]:    -> running basename http://initd.org/psycopg/tarballs/psycopg2-latest.tar.gz
[INFO]:    -> running rm -f .mark-psycopg2-latest.tar.gz                                                                                                                                                                 
[INFO]:    Downloading psycopg2 from http://initd.org/psycopg/tarballs/psycopg2-latest.tar.gz
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1196, in <module>
    main()
  File "/home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 671, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 155, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 209, in build_dist_from_args
    args, "ignore_setup_py", False
  File "/home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 558, in build_recipes
    recipe.download_if_necessary()
  File "/home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 356, in download_if_necessary
    self.download()
  File "/home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 402, in download
    self.download_file(self.versioned_url, filename)
  File "/home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/python-for-android/pythonforandroid/recipe.py", line 217, in download_file
    urlretrieve(url, target, report_hook)
  File "/usr/lib/python3.7/urllib/request.py", line 1819, in retrieve
    block = fp.read(bs)
  File "/usr/lib/python3.7/tempfile.py", line 481, in func_wrapper
    return func(*args, **kwargs)
ValueError: read of closed file
# Command failed: /home/rene/.cache/pypoetry/virtualenvs/andtst-xFjg9C1i-py3.7/bin/python3.7 -m pythonforandroid.toolchain create --dist_name=flask_example --bootstrap=sdl2 --requirements=python3,kivy,psycopg2, --arch arm64-v8a --copy-libs --color=always --storage-dir="/home/rene/git/gud/aggregator/andtst/.buildozer/android/platform/build-arm64-v8a" --ndk-api=21
# ENVIRONMENT:
#     SHELL = '/bin/zsh'
#     SESSION_MANAGER = 'local/desktop:@/tmp/.ICE-unix/1055,unix/desktop:/tmp/.ICE-unix/1055'
#     WINDOWID = '0'
#     COLORTERM = 'truecolor'
#     LESS = '-F -g -i -M -R -S -w -X -z-4'
#     GREP_COLOR = '37;45'
#     XDG_SESSION_PATH = '/org/freedesktop/DisplayManager/Session1'
#     LESS_TERMCAP_se = '\x1b[0m'
#     LESS_TERMCAP_so = '\x1b[00;47;30m'
#     SHELL_SESSION_ID = '453d05c6ce7e4298922c7b305e877941'
#     DESKTOP_SESSION = '/usr/share/xsessions/plasma'
#     GTK_RC_FILES = '/etc/gtk/gtkrc:/home/rene/.gtkrc:/home/rene/.config/gtkrc'
#     GREP_COLORS = 'mt=37;45'
#     EDITOR = 'nvim'
#     GTK_MODULES = 'canberra-gtk-module'
#     XDG_SEAT = 'seat0'
#     PWD = '/home/rene/git/gud/aggregator/andtst'
#     XDG_SESSION_DESKTOP = 'KDE'
#     LOGNAME = 'rene'
#     XDG_SESSION_TYPE = 'x11'
#     _ = '/home/rene/.cache/pypoetry/virtualenvs/andtst-xFjg9C1i-py3.7/bin/buildozer'
#     XAUTHORITY = '/tmp/xauth-1000-_0'
#     GTK2_RC_FILES = '/etc/gtk-2.0/gtkrc:/home/rene/.gtkrc-2.0:/home/rene/.config/gtkrc-2.0'
#     HOME = '/home/rene'
#     LANG = 'en_CA.UTF-8'
#     LS_COLORS = 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.pdf=00;32:*.ps=00;32:*.txt=00;32:*.patch=00;32:*.diff=00;32:*.log=00;32:*.tex=00;32:*.doc=00;32:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:'
#     XDG_CURRENT_DESKTOP = 'KDE'
#     KONSOLE_DBUS_SERVICE = ':1.31'
#     KONSOLE_DBUS_SESSION = '/Sessions/1'
#     XDG_SEAT_PATH = '/org/freedesktop/DisplayManager/Seat0'
#     KONSOLE_VERSION = '191203'
#     KDE_SESSION_UID = '1000'
#     XDG_SESSION_CLASS = 'user'
#     TERM = 'xterm-256color'
#     LESS_TERMCAP_mb = '\x1b[01;31m'
#     LESS_TERMCAP_me = '\x1b[0m'
#     LESS_TERMCAP_md = '\x1b[01;31m'
#     USER = 'rene'
#     CUDA_PATH = '/opt/cuda'
#     COLORFGBG = '0;15'
#     KDE_SESSION_VERSION = '5'
#     PAM_KWALLET5_LOGIN = '/run/user/1000/kwallet5.socket'
#     VISUAL = 'nvim'
#     DISPLAY = ':0'
#     LESS_TERMCAP_ue = '\x1b[0m'
#     SHLVL = '3'
#     LESS_TERMCAP_us = '\x1b[01;32m'
#     PAGER = 'less'
#     XDG_VTNR = '1'
#     XDG_SESSION_ID = '2'
#     QT_LINUX_ACCESSIBILITY_ALWAYS_ON = '1'
#     MOZ_PLUGIN_PATH = '/usr/lib/mozilla/plugins'
#     XDG_RUNTIME_DIR = '/run/user/1000'
#     QT_AUTO_SCREEN_SCALE_FACTOR = '0'
#     XCURSOR_THEME = 'breeze_cursors'
#     XDG_DATA_DIRS = '/home/rene/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop'
#     KDE_FULL_SESSION = 'true'
#     PATH = '/home/rene/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/rene/.cache/pypoetry/virtualenvs/andtst-xFjg9C1i-py3.7/bin:/home/rene/.local/bin:/home/rene/.local/bin:/home/rene/.local/bin:/usr/local/bin:/usr/local/sbin:/home/rene/.cargo/bin:/home/rene/.gem/ruby/2.7.0/bin:/usr/lib/ruby/gems/2.7.0/bin:/usr/bin:/opt/cuda/bin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin'
#     DBUS_SESSION_BUS_ADDRESS = 'unix:path=/run/user/1000/bus'
#     MAIL = '/var/spool/mail/rene'
#     OLDPWD = '/home/rene/git/gud/aggregator/andtst'
#     APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL = 'true'
#     NO_AT_BRIDGE = '1'
#     CHROME_DESKTOP = 'code-oss.desktop'
#     TERM_PROGRAM = 'vscode'
#     TERM_PROGRAM_VERSION = '1.43.1'
#     POETRY_ACTIVE = '1'
#     VIRTUAL_ENV = '/home/rene/.cache/pypoetry/virtualenvs/andtst-xFjg9C1i-py3.7'
#     PS1 = ('(andtst-xFjg9C1i-py3.7) \n'
 '${(e)$(prompt_paradox_build_prompt)}\n'
 ' ${editor_info[keymap]} ')
#     PACKAGES_PATH = '/home/rene/.buildozer/android/packages'
#     ANDROIDSDK = '/home/rene/.buildozer/android/platform/android-sdk'
#     ANDROIDNDK = '/home/rene/.buildozer/android/platform/android-ndk-r19b'
#     ANDROIDAPI = '27'
#     ANDROIDMINAPI = '21'
# 
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
```
</details>



Discussion:

Resolving patch:
diff --git a/pythonforandroid/recipes/psycopg2/__init__.py b/pythonforandroid/recipes/psycopg2/__init__.py
--- a/pythonforandroid/recipes/psycopg2/__init__.py
+++ b/pythonforandroid/recipes/psycopg2/__init__.py
@@ -10,8 +10,8 @@ class Psycopg2Recipe(PythonRecipe):
     `ANDROID_API` (`ndk-api`) >= 26, see:
     https://github.com/kivy/python-for-android/issues/1711#issuecomment-465747557
     """
-    version = 'latest'
-    url = 'http://initd.org/psycopg/tarballs/psycopg2-{version}.tar.gz'
+    version = '2.8.4'
+    url = 'https://pypi.python.org/packages/source/p/psycopg2/psycopg2-{version}.tar.gz'
     depends = ['libpq']
     site_packages_name = 'psycopg2'
     call_hostpython_via_targetpython = False


Test patch: