I developed a kivy app and everything works perfectly on my laptop and on my android phone too (in debug mode). The next step is to make a release so that I can finally publish the app.
I followed the instructions mentioned here to generate a release APK (generate a key etc..) and then I run
buildozer -v android release
Now here an error occurs. I searched for two days now but I wasn't able to solve the problem. The app works perfectly without using release. I even installed it on my phone and it works. This happens only during release.
Here is the part of the log showing the error:
Listing '/home/nidhal/Desktop/my_code/deep-translator-app/.buildozer/android/platform/build-armeabi-v7a/dists/translator-pp__armeabi-v7a/_python_bundle/_python_bundle/site-packages/usr/local/bin'...
[INFO]: Detected highest available build tools version to be 30.0.1
[DEBUG]: -> running gradlew assembleRelease
[DEBUG]: /home/nidhal/Desktop/my_code/deep-translator-app/.buildozer/android/platform/build-armeabi-v7a/dists/translator-pp__armeabi-v7a/build/intermediates/manifests/full/release/AndroidManifest.xml:6: AAPT: error: attribute 'package' in <manifest> tag is not a valid Android package name: 'org.translator-pp.translator-pp'.
[DEBUG]:
[DEBUG]: > Task :processReleaseResources FAILED
[DEBUG]:
[DEBUG]: FAILURE: Build failed with an exception.
[DEBUG]:
[DEBUG]: * What went wrong:
[DEBUG]: Execution failed for task ':processReleaseResources'.
[DEBUG]: > Failed to process resources, see aapt output above for details.
[DEBUG]:
[DEBUG]: * Try:
[DEBUG]: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[DEBUG]:
[DEBUG]: * Get more help at https://help.gradle.org
[DEBUG]:
[DEBUG]: Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
[DEBUG]: Use '--warning-mode all' to show the individual deprecation warnings.
[DEBUG]: See https://docs.gradle.org/6.4.1/userguide/command_line_interface.html#sec:command_line_warnings
[DEBUG]:
[DEBUG]: BUILD FAILED in 2s
[DEBUG]: 13 actionable tasks: 13 executed
[DEBUG]:
[DEBUG]:
Exception in thread background thread for pid 5684:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/nidhal/.local/lib/python3.6/site-packages/sh.py", line 1540, in wrap
fn(*args, **kwargs)
File "/home/nidhal/.local/lib/python3.6/site-packages/sh.py", line 2459, in background_thread
handle_exit_code(exit_code)
File "/home/nidhal/.local/lib/python3.6/site-packages/sh.py", line 2157, in fn
return self.command.handle_command_exit_code(exit_code)
File "/home/nidhal/.local/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_1:
RAN: /home/nidhal/Desktop/my_code/deep-translator-app/.buildozer/android/platform/build-armeabi-v7a/dists/translator-pp__armeabi-v7a/gradlew assembleRelease
STDOUT:
/home/nidhal/Desktop/my_code/deep-translator-app/.buildozer/android/platform/build-armeabi-v7a/dists/translator-pp__armeabi-v7a/build/intermediates/manifests/full/release/AndroidManifest.xml:6: AAPT: error: attribute 'package' in <manifest> tag is not a valid Android package name: 'org.translator-pp.translator-pp'.
> Task :processReleaseResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processReleaseResources'.
> Failed to process resources, see aapt output above for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.4.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2s
13 actionable tasks: 13 executed
STDERR:
[INFO]: STDOUT (last 20 lines of 26):
[DEBUG]:FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processReleaseResources'.
> Failed to process resources, see aapt output above for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.4.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2s
13 actionable tasks: 13 executed
[INFO]: STDERR:
[INFO]: COMMAND:
cd /home/nidhal/Desktop/my_code/deep-translator-app/.buildozer/android/platform/build-armeabi-v7a/dists/translator-pp__armeabi-v7a && /home/nidhal/Desktop/my_code/deep-translator-app/.buildozer/android/platform/build-armeabi-v7a/dists/translator-pp__armeabi-v7a/gradlew assembleRelease
[WARNING]: ERROR: /home/nidhal/Desktop/my_code/deep-translator-app/.buildozer/android/platform/build-armeabi-v7a/dists/translator-pp__armeabi-v7a/gradlew failed!
WARNING: Received a --sdk argument, but this argument is deprecated and does nothing.
No setup.py/pyproject.toml used, copying full private data into .apk.
Applying Java source code patches...
Applying patch: src/patches/SDLActivity.java.patch
# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain apk --debug --bootstrap=sdl2 --dist_name translator-pp --name Translator --version 1.0.0 --package org.translator-pp.translator-pp --minsdk 21 --ndk-api 21 --private /home/nidhal/Desktop/my_code/deep-translator-app/.buildozer/android/app --permission INTERNET --android-entrypoint org.kivy.android.PythonActivity --android-apptheme @android:style/Theme.NoTitleBar --orientation portrait --window --release --sign --copy-libs --arch armeabi-v7a --color=always --storage-dir="/home/nidhal/Desktop/my_code/deep-translator-app/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21
# ENVIRONMENT:
# CLUTTER_IM_MODULE = 'xim'
# CONDA_SHLVL = '0'
# 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=40;31;01:mi=00: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:*.zst=01;31:*.tzst=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:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=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:*.ogv=01;35:*.ogx=01;35:*.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:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'
# CONDA_EXE = '/home/nidhal/anaconda3/bin/conda'
# sdkman_beta_channel = 'false'
# LC_MEASUREMENT = 'de_DE.UTF-8'
# LESSCLOSE = '/usr/bin/lesspipe %s %s'
# LC_PAPER = 'de_DE.UTF-8'
# LC_MONETARY = 'de_DE.UTF-8'
# XDG_MENU_PREFIX = 'gnome-'
# LANG = 'en_US.UTF-8'
# DISPLAY = ':0'
# OLDPWD = '/home/nidhal/keystores'
# P4A_RELEASE_KEYALIAS = 'release'
# SDKMAN_CANDIDATES_API = 'https://api.sdkman.io/2'
# GNOME_SHELL_SESSION_MODE = 'ubuntu'
# COLORTERM = 'truecolor'
# USERNAME = 'nidhal'
# XDG_VTNR = '1'
# SSH_AUTH_SOCK = '/run/user/1000/keyring/ssh'
# MANDATORY_PATH = '/usr/share/gconf/ubuntu.mandatory.path'
# _CE_M = ''
# LC_NAME = 'de_DE.UTF-8'
# XDG_SESSION_ID = '1'
# USER = 'nidhal'
# DESKTOP_SESSION = 'ubuntu'
# sdkman_debug_mode = 'false'
# QT4_IM_MODULE = 'xim'
# TEXTDOMAINDIR = '/usr/share/locale/'
# binary_input = '/home/nidhal/.sdkman/tmp/gradle-6.5.1.bin'
# P4A_RELEASE_KEYSTORE_PASSWD = 'android'
# GRADLE_HOME = '/home/nidhal/.sdkman/candidates/gradle/current'
# GNOME_TERMINAL_SCREEN = '/org/gnome/Terminal/screen/fd24cb48_e51f_436c_8c85_e71004718c99'
# DEFAULTS_PATH = '/usr/share/gconf/ubuntu.default.path'
# PWD = '/home/nidhal/Desktop/my_code/deep-translator-app'
# HOME = '/home/nidhal'
# CONDA_PYTHON_EXE = '/home/nidhal/anaconda3/bin/python'
# TEXTDOMAIN = 'im-config'
# SSH_AGENT_PID = '3263'
# QT_ACCESSIBILITY = '1'
# LIBVIRT_DEFAULT_URI = 'qemu:///system'
# XDG_SESSION_TYPE = 'x11'
# XDG_DATA_DIRS = '/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop'
# _CE_CONDA = ''
# XDG_SESSION_DESKTOP = 'ubuntu'
# P4A_RELEASE_KEYSTORE = '/home/nidhal/keystores/key.keystore'
# LC_ADDRESS = 'de_DE.UTF-8'
# GJS_DEBUG_OUTPUT = 'stderr'
# LC_NUMERIC = 'de_DE.UTF-8'
# SDKMAN_DIR = '/home/nidhal/.sdkman'
# GTK_MODULES = 'gail:atk-bridge'
# WINDOWPATH = '1'
# TERM = 'xterm-256color'
# SHELL = '/bin/bash'
# VTE_VERSION = '5202'
# QT_IM_MODULE = 'ibus'
# XMODIFIERS = '@im=ibus'
# IM_CONFIG_PHASE = '2'
# SDKMAN_CANDIDATES_DIR = '/home/nidhal/.sdkman/candidates'
# XDG_CURRENT_DESKTOP = 'ubuntu:GNOME'
# GPG_AGENT_INFO = '/run/user/1000/gnupg/S.gpg-agent:0:1'
# GNOME_TERMINAL_SERVICE = ':1.84'
# P4A_RELEASE_KEYALIAS_PASSWD = 'android'
# XDG_SEAT = 'seat0'
# SHLVL = '1'
# LC_TELEPHONE = 'de_DE.UTF-8'
# GDMSESSION = 'ubuntu'
# GNOME_DESKTOP_SESSION_ID = 'this-is-deprecated'
# LOGNAME = 'nidhal'
# DBUS_SESSION_BUS_ADDRESS = 'unix:path=/run/user/1000/bus'
# XDG_RUNTIME_DIR = '/run/user/1000'
# XAUTHORITY = '/run/user/1000/gdm/Xauthority'
# XDG_CONFIG_DIRS = '/etc/xdg/xdg-ubuntu:/etc/xdg'
# PATH = '/home/nidhal/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/nidhal/.sdkman/candidates/gradle/current/bin:/usr/local/android-studio:/usr/local/android-studio/bin:/home/nidhal/anaconda3/condabin:/home/nidhal/.cargo/bin:/home/nidhal/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/nidhal/.local/bin/'
# LC_IDENTIFICATION = 'de_DE.UTF-8'
# SDKMAN_VERSION = '5.8.2+493'
# zip_output = '/home/nidhal/.sdkman/tmp/gradle-6.5.1.zip'
# GJS_DEBUG_TOPICS = 'JS ERROR;JS LOG'
# SDKMAN_PLATFORM = 'Linux64'
# SESSION_MANAGER = 'local/nidhal-Latitude-E6320:@/tmp/.ICE-unix/3074,unix/nidhal-Latitude-E6320:/tmp/.ICE-unix/3074'
# LESSOPEN = '| /usr/bin/lesspipe %s'
# GTK_IM_MODULE = 'ibus'
# LC_TIME = 'de_DE.UTF-8'
# _ = '/home/nidhal/.local/bin/buildozer'
# PACKAGES_PATH = '/home/nidhal/.buildozer/android/packages'
# ANDROIDSDK = '/home/nidhal/.buildozer/android/platform/android-sdk'
# ANDROIDNDK = '/home/nidhal/.buildozer/android/platform/android-ndk-r19c'
# 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
Additionally, here is a link for the full log
Hope someone had this problem before and was able to solve it. I'm blocked with this issue.
So after long debug sessions. I figure out that this error is due to me using dash in my buildozer.spec file. This is sort of weird but this was the bug.
So if you are using any names with dash in it in the spec file, you need to remove it and run:
buildozer -v android clean release