Another signal11, Cause: null pointer dereference

706 views
Skip to first unread message

Marco Mastroeni

unread,
Oct 31, 2022, 11:59:35 AM10/31/22
to Kivy users support
Greetings to all,
I come from issues 1521, in search of suggestions and wisdom. I have this app that is compiled from Linux to android, I deploy, I run it, when I open determinate widgets, it crashes with:

10-31 13:17:07.468 11260 11260 F DEBUG   : Cmdline: org.test.myapp
10-31 13:17:07.468 11260 11260 F DEBUG   : pid: 11220, tid: 11250, name: SDLThread  >>> org.test.myapp <<<
10-31 13:17:07.468 11260 11260 F DEBUG   : uid: 10403
10-31 13:17:07.468 11260 11260 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x40
10-31 13:17:07.468 11260 11260 F DEBUG   : Cause: null pointer dereference
10-31 13:17:07.468 11260 11260 F DEBUG   :     x0  0000000000000001  x1  0000000000000000  x2  0000000000000003  x3  000000000000001c
10-31 13:17:07.468 11260 11260 F DEBUG   :     x4  000000741445e8fc  x5  0000000000000003  x6  000000741445ebac  x7  000000000008a000
10-31 13:17:07.468 11260 11260 F DEBUG   :     x8  0000000000000003  x9  0000000000000003  x10 000000727be23164  x11 000000741445e904
10-31 13:17:07.468 11260 11260 F DEBUG   :     x12 000000750448256c  x13 000000727be2316c  x14 0000000000000000  x15 0000000000000000
10-31 13:17:07.468 11260 11260 F DEBUG   :     x16 0000000000000001  x17 0000000000000000  x18 0000000000000000  x19 000000727be232b0
10-31 13:17:07.468 11260 11260 F DEBUG   :     x20 000000741445e840  x21 00000075044800c0  x22 0000000000000000  x23 0000000000000003
10-31 13:17:07.468 11260 11260 F DEBUG   :     x24 0000000000000000  x25 0000000000000001  x26 0000000000000000  x27 0000000000000001
10-31 13:17:07.468 11260 11260 F DEBUG   :     x28 0000000000000068  x29 000000727be23170
10-31 13:17:07.468 11260 11260 F DEBUG   :     lr  00000072d478fcd8  sp  000000727be23130  pc  00000072d47a24a0  pst 0000000060001000

First case, was with a Dropdownmenu, the incriminated line was "menu.open()"
I removed it, and putting a NavigationDrawers, it now crashes as it open a second menu as a list on an MDDialog. Also if I try tu insert a  "MDFloatingActionButton" (other types of button seems to work all so far) it crashes from the startup. Maybe the problem is with some permission of the App, but I honestly don't have any idea what the screen could require. My buildozer.spec is

[app]

# (str) Title of your application
title = myapp

# (str) Package name
package.name = myapp

# (str) Package domain (needed for android/ios packaging)
package.domain = org.test

# (str) Source code where the main.py live
source.dir = .

# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas,ogg

# (list) List of inclusions using pattern matching
#source.include_patterns = assets/*,images/*.png

# (list) Source files to exclude (let empty to not exclude anything)
#source.exclude_exts = spec

# (list) List of directory to exclude (let empty to not exclude anything)
#source.exclude_dirs = tests, bin, venv

# (list) List of exclusions using pattern matching
# Do not prefix with './'
#source.exclude_patterns = license,images/*/*.jpg

# (str) Application versioning (method 1)
version = 0.1

# (str) Application versioning (method 2)
# version.regex = __version__ = ['"](.*)['"]
# version.filename = %(source.dir)s/main.py

# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy,kivmob,kivymd

# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy

# (str) Presplash of the application
presplash.filename = %(source.dir)s/data/Splash.png

# (str) Icon of the application
icon.filename = %(source.dir)s/data/icon.png

# (str) Supported orientation (one of landscape, sensorLandscape, portrait or all)
orientation = all

# (list) List of service to declare
#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY

#
# OSX Specific
#

#
# author = © Copyright Info

# change the major version of python used by the app
osx.python_version = 3

# Kivy version to use
osx.kivy_version = 1.9.1

#
# Android specific
#

# (bool) Indicate if the application should be fullscreen or not
fullscreen = 0

# (string) Presplash background color (for android toolchain)
# Supported formats are: #RRGGBB #AARRGGBB or one of the following names:
# red, blue, green, black, white, gray, cyan, magenta, yellow, lightgray,
# darkgray, grey, lightgrey, darkgrey, aqua, fuchsia, lime, maroon, navy,
# olive, purple, silver, teal.
#android.presplash_color = #FFFFFF

# (string) Presplash animation using Lottie format.
# see https://lottiefiles.com/ for examples and https://airbnb.design/lottie/
# for general documentation.
# Lottie files can be created using various tools, like Adobe After Effect or Synfig.
#android.presplash_lottie = "path/to/lottie/file.json"

# (str) Adaptive icon of the application (used if Android API level is 26+ at runtime)
#icon.adaptive_foreground.filename = %(source.dir)s/data/icon_fg.png
#icon.adaptive_background.filename = %(source.dir)s/data/icon_bg.png

# (list) Permissions
android.permissions = INTERNET, ACCESS_NETWORK_STATE

# (list) features (adds uses-feature -tags to manifest)
#android.features = android.hardware.usb.host

# (int) Target Android API, should be as high as possible.
android.api = 33

# (int) Minimum API your APK / AAB will support.
#android.minapi = 21

# (int) Android SDK version to use
#android.sdk = 24

# (str) Android NDK version to use
#android.ndk = 23b

# (int) Android NDK API to use. This is the minimum API your app will support, it should usually match android.minapi.
#android.ndk_api = 21

# (bool) Use --private data storage (True) or --dir public storage (False)
#android.private_storage = True

# (str) Android NDK directory (if empty, it will be automatically downloaded.)
#android.ndk_path =

# (str) Android SDK directory (if empty, it will be automatically downloaded.)
#android.sdk_path =

# (str) ANT directory (if empty, it will be automatically downloaded.)
#android.ant_path =

# (bool) If True, then skip trying to update the Android sdk
# This can be useful to avoid excess Internet downloads or save time
# when an update is due and you just want to test/build your package
# android.skip_update = False

# (bool) If True, then automatically accept SDK license
# agreements. This is intended for automation only. If set to False,
# the default, you will be shown the license when first running
# buildozer.
# android.accept_sdk_license = False

# (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.kivy.android.PythonActivity

# (str) Full name including package path of the Java class that implements Android Activity
# use that parameter together with android.entrypoint to set custom Java class instead of PythonActivity
#android.activity_class_name = org.kivy.android.PythonActivity

# (str) Extra xml to write directly inside the <manifest> element of AndroidManifest.xml
# use that parameter to provide a filename from where to load your custom XML code
#android.extra_manifest_xml = ./src/android/extra_manifest.xml

# (str) Extra xml to write directly inside the <manifest><application> tag of AndroidManifest.xml
# use that parameter to provide a filename from where to load your custom XML arguments:
#android.extra_manifest_application_arguments = ./src/android/extra_manifest_application_arguments.xml

# (str) Full name including package path of the Java class that implements Python Service
# use that parameter to set custom Java class instead of PythonService
#android.service_class_name = org.kivy.android.PythonService

# (str) Android app theme, default is ok for Kivy-based app
# android.apptheme = "@android:style/Theme.NoTitleBar"

# (list) Pattern to whitelist for the whole project
#android.whitelist =

# (str) Path to a custom whitelist file
#android.whitelist_src =

# (str) Path to a custom blacklist file
#android.blacklist_src =

# (list) List of Java .jar files to add to the libs so that pyjnius can access
# their classes. Don't add jars that you do not need, since extra jars can slow
# down the build process. Allows wildcards matching, for example:
# OUYA-ODK/libs/*.jar
#android.add_jars = foo.jar,bar.jar,path/to/more/*.jar

# (list) List of Java files to add to the android project (can be java or a
# directory containing the files)
#android.add_src =

# (list) Android AAR archives to add
#android.add_aars =

# (list) Put these files or directories in the apk assets directory.
# Either form may be used, and assets need not be in 'source.include_exts'.
# 1) android.add_assets = source_asset_relative_path
# 2) android.add_assets = source_asset_path:destination_asset_relative_path
#android.add_assets =

# (list) Gradle dependencies to add
#android.gradle_dependencies = 'com.google.firebase:firebase-ads:10.2.0'

# (bool) Enable AndroidX support. Enable when 'android.gradle_dependencies'
# contains an 'androidx' package, or any package from Kotlin source.
# android.enable_androidx requires android.api >= 28
#android.enable_androidx = False

# (list) add java compile options
# this can for example be necessary when importing certain java libraries using the 'android.gradle_dependencies' option
# see https://developer.android.com/studio/write/java8-support for further information
# android.add_compile_options = "sourceCompatibility = 1.8", "targetCompatibility = 1.8"

# (list) Gradle repositories to add {can be necessary for some android.gradle_dependencies}
# please enclose in double quotes
# e.g. android.gradle_repositories = "maven { url 'https://kotlin.bintray.com/ktor' }"
#android.add_gradle_repositories =

# (list) packaging options to add
# see https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html
# can be necessary to solve conflicts in gradle_dependencies
# please enclose in double quotes
# e.g. android.add_packaging_options = "exclude 'META-INF/common.kotlin_module'", "exclude 'META-INF/*.kotlin_module'"
#android.add_packaging_options =

# (list) Java classes to add as activities to the manifest.
#android.add_activities = com.example.ExampleActivity

# (str) OUYA Console category. Should be one of GAME or APP
# If you leave this blank, OUYA support will not be enabled
#android.ouya.category = GAME

# (str) Filename of OUYA Console icon. It must be a 732x412 png image.
#android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png

# (str) XML file to include as an intent filters in <activity> tag
#android.manifest.intent_filters =

# (str) launchMode to set for the main activity
#android.manifest.launch_mode = standard

# (list) Android additional libraries to copy into libs/armeabi
#android.add_libs_armeabi = libs/android/*.so
#android.add_libs_armeabi_v7a = libs/android-v7/*.so
#android.add_libs_arm64_v8a = libs/android-v8/*.so
#android.add_libs_x86 = libs/android-x86/*.so
#android.add_libs_mips = libs/android-mips/*.so

# (bool) Indicate whether the screen should stay on
# Don't forget to add the WAKE_LOCK permission if you set this to True
#android.wakelock = False

# (list) Android application meta-data to set (key=value format)
android.meta_data = com.google.android.gms.ads.APPLICATION_ID=ca-app-pub-3940256099942544~3347511713



# (list) Android library project to add (will be added in the
# project.properties automatically.)
#android.library_references =

# (list) Android shared libraries which will be added to AndroidManifest.xml using <uses-library> tag
#android.uses_library =

# (str) Android logcat filters to use
#android.logcat_filters = *:S python:D

# (bool) Android logcat only display log for activity's pid
#android.logcat_pid_only = False

# (str) Android additional adb arguments
#android.adb_args = -H host.docker.internal

# (bool) Copy library instead of making a libpymodules.so
#android.copy_libs = 1

# (list) The Android archs to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64
# In past, was `android.arch` as we weren't supporting builds for multiple archs at the same time.
android.archs = arm64-v8a, armeabi-v7a

# (int) overrides automatic versionCode computation (used in build.gradle)
# this is not the same as app version and should only be edited if you know what you're doing
# android.numeric_version = 1

# (bool) enables Android auto backup feature (Android API >=23)
android.allow_backup = True

# (str) XML file for custom backup rules (see official auto backup documentation)
# android.backup_rules =

# (str) If you need to insert variables into your AndroidManifest.xml file,
# you can do so with the manifestPlaceholders property.
# This property takes a map of key-value pairs. (via a string)
# Usage example : android.manifest_placeholders = [myCustomUrl:\"org.kivy.customurl\"]
# android.manifest_placeholders = [:]

# (bool) disables the compilation of py to pyc/pyo files when packaging
# android.no-compile-pyo = True

# (str) The format used to package the app for release mode (aab or apk or aar).
# android.release_artifact = aab

# (str) The format used to package the app for debug mode (apk or aar).
# android.debug_artifact = apk

#
# Python for android (p4a) specific
#

# (str) python-for-android URL to use for checkout
#p4a.url =

# (str) python-for-android fork to use in case if p4a.url is not specified, defaults to upstream (kivy)
#p4a.fork = kivy

# (str) python-for-android branch to use, defaults to master
#p4a.branch = master

# (str) python-for-android specific commit to use, defaults to HEAD, must be within p4a.branch
#p4a.commit = HEAD

# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
#p4a.source_dir =

# (str) The directory in which python-for-android should look for your own build recipes (if any)
#p4a.local_recipes =

# (str) Filename to the hook for p4a
#p4a.hook =

# (str) Bootstrap to use for android builds
# p4a.bootstrap = sdl2

# (int) port number to specify an explicit --port= p4a argument (eg for bootstrap flask)
#p4a.port =

# Control passing the --use-setup-py vs --ignore-setup-py to p4a
# "in the future" --use-setup-py is going to be the default behaviour in p4a, right now it is not
# Setting this to false will pass --ignore-setup-py, true will pass --use-setup-py
# NOTE: this is general setuptools integration, having pyproject.toml is enough, no need to generate
# setup.py if you're using Poetry, but you need to add "toml" to source.include_exts.
#p4a.setup_py = false

# (str) extra command line arguments to pass when invoking pythonforandroid.toolchain
#p4a.extra_args =

Thank you in advance,
Marco

Marco Mastroeni

unread,
Nov 3, 2022, 8:21:59 PM11/3/22
to Kivy users support
All right, It comes out that on android-emulator the app works (perfectly). Whatever just happened, the blame (unfortunately) must be on my (new) smartphone.
Marco

Robert

unread,
Nov 3, 2022, 9:56:21 PM11/3/22
to Kivy users support
Memory corruption errors manifest in an apparently random way; they just happen to be visible in some environment and not in another.
That means that when it works, it works for the wrong reason and, you got lucky; and not that it doesn't work in some case (though it may look that way).

The symptom may or may not be related to the apparent cause. But generally you are probably looking for something that mis-uses an Android api.

I notice Kivmod is a requirement but its Gradle dependency is commented - that dependency probably uses an Android api. I have never used Kivmob, but without the dependency it is presumably not initialized, so check you are not using Kivmob related code that is not initialized.

That may not be the issue, but that is the approach.

Marco Mastroeni

unread,
Nov 4, 2022, 7:50:03 AM11/4/22
to Kivy users support
Mr Robert,
unfortunately the code with kivmob and firebase is there commented because I can't use it: when I uncomment the gradle dependency the  packaging fils with a ""Build failed: Asked to compile for no Archs, so failing"

The code related to kivmob for now it is all commented. Another thing I don't understand is that there are at least three components of KIvyMD that causes this error, which are the menu dropdown (menu.open), the MDFlatbutton (just when is declared) and apparently the MDdialog when is called. I gave a look on the documentation on KivyMD and there isn't any mention at any dipendency (also I couldn't find any documentation about asking permission on the display)

Robert

unread,
Nov 4, 2022, 1:30:29 PM11/4/22
to Kivy users support
Sorry I cant help you.

The error message has been seen once before, but seems unrelated https://github.com/kivy/python-for-android/issues/2685

I have heard of this message https://github.com/Android-for-Python/Android-for-Python-Users#androidexported in this case because the version in the dependency is obsolete (ask KivMob for the correct version).

Test your KivMob comments by removing it from requirements then https://github.com/Android-for-Python/Android-for-Python-Users#changing-buildozerspec

I understand you see symptoms with KivyMD, I don't know anything about any KivyMD issues like this, ask the KivyMD project. 

I still suspect a miss use of an Android api somewhere.

Marco Mastroeni

unread,
Nov 4, 2022, 8:46:52 PM11/4/22
to Kivy users support
Don't worry Mr Robert, instead I (really) appreciate that you spent your time om this.
Unfortunately I asked to the KivyMD project before opening the issue #1521, the answer was that it is not related to KivyMD. For me is not really a big deal because at some point I will just have to replace the not working modules of KivyMD with the Kivy equivalent ones.

However, about KIvMob I uncommented all the code according to the tutorial, but what I get (for the first time I inserted their code on the app) is
"[INFO]:    Detected highest available build tools version to be 33.0.0
[DEBUG]:   -> running gradlew assembleDebug
[DEBUG]:      
[DEBUG]:       FAILURE: Build failed with an exception.
[DEBUG]:      
[DEBUG]:       * Where:
[DEBUG]:       Build file '/home/maxtro/Projects/App_Naza/Sviluppo/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/myapp/build.gradle'
[DEBUG]:      
[DEBUG]:       * What went wrong:
[DEBUG]:       Could not compile build file '/home/maxtro/Projects/App_Naza/Sviluppo/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/myapp/build.gradle'.
[DEBUG]:       > startup failed:
[DEBUG]:        General error during conversion: Unsupported class file major version 63
[DEBUG]:      
[DEBUG]:        java.lang.IllegalArgumentException: Unsupported class file major version 63"

That make me think I must have some type of problem with gradle/JVM. Also I don't understand if after this issue the part in buildozer.spec must be modified or not.
Maybe I shall ask them?

Robert

unread,
Nov 5, 2022, 2:36:35 AM11/5/22
to Kivy users support
My suggestion was to do the exact opposite, check that KivMob is really removed..
However given your choice of action.....

Wow, you keep creating new issues, this message is documented too:
I don't know what Java archive you are using, but it was built with an incompatible Java version.

If you guessed about a version of firebase-ads, it was not a good guess. Guessing seems very risky, yes ask KivMob.

Marco Mastroeni

unread,
Nov 5, 2022, 10:53:43 AM11/5/22
to Kivy users support
I am sorry, I don't do it on purpose. I am just doing it in case that someone that has the same problem bump here and know all I tried before.
The issue was present before I tried with KivMob, but just to be sure I will recheck if doing what you suggest anything changes.

I think I tried before  to compile the application with other Java environment, set with the command "export JAVA_HOME=/usr/lib/jvm/java-17-openjdk" but I would like to give it a check just to be sure I am not saying anything fancy (and to be sure). In the mean time if this doesn't work I will ask information at KivMob.

Marco Mastroeni

unread,
Nov 6, 2022, 8:19:04 AM11/6/22
to Kivy users support
Mr Robert, your suggestion solved (mostly) the problem:
with "export JAVA_HOME=/usr/lib/jvm/java-17-openjdk" now the problam compiles and work with Kivymob. Only things that prevent this part to work is now a
"11-06 13:54:11.654 13097 13097 I python  :  Traceback (most recent call last):
11-06 13:54:11.654 13097 13097 I python  :    File "/home/maxtro/Projects/App_Naza/Sviluppo/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/arm64-v8a/android/runnable.py", line 38, in run
11-06 13:54:11.654 13097 13097 I python  :    File "/home/maxtro/Projects/App_Naza/Sviluppo/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/arm64-v8a/kivmob.py", line 217, in new_banner
11-06 13:54:11.654 13097 13097 I python  :    File "jnius/jnius_export_class.pxi", line 844, in jnius.jnius.JavaMethod.__call__
11-06 13:54:11.654 13097 13097 I python  :  jnius.jnius.JavaException: Cannot call instance method b'addContentView' on class b'org/kivy/android/PythonActivity'
11-06 13:54:11.659 13097 13097 I python  :  Traceback (most recent call last):
11-06 13:54:11.659 13097 13097 I python  :    File "/home/maxtro/Projects/App_Naza/Sviluppo/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/arm64-v8a/android/runnable.py", line 38, in run
11-06 13:54:11.659 13097 13097 I python  :    File "/home/maxtro/Projects/App_Naza/Sviluppo/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/arm64-v8a/kivmob.py", line 217, in new_banner
11-06 13:54:11.659 13097 13097 I python  :    File "jnius/jnius_export_class.pxi", line 844, in jnius.jnius.JavaMethod.__call__
11-06 13:54:11.659 13097 13097 I python  :  jnius.jnius.JavaException: Cannot call instance method b'addContentView' on class b'org/kivy/android/PythonActivity'"
That I don't understand, since jnius is already loaded in my buildozer.spec:
"requirements = python3,kivy,jnius,kivmob,kivymd"

On the other side, talking about the null point dereference,
A) I decided to get rid of this annoying "MDFloatingActionButton" in favor of an MDIconButton (this one works out-of-the-box)
B) I tried the fifth example in the kivyMD documentation: copying and compiling it doesn't work.

Marco M.

Robert

unread,
Nov 6, 2022, 12:12:47 PM11/6/22
to Kivy users support
It not clear to me that anything is solved.
It looks to me like you are finding new issues without finding the cause of the original issue.

1) That message appears to be some issue related the way KivMob is used.
But I've never seen anybody have that issue, and I have never used KivMob.

>>>kivmob.py", line 217, in new_banner

But the message contains addContentView but that is in a different place https://github.com/MichaelStott/KivMob/blob/master/kivmob.py#L261
It looks like kivmob.py has been changed.

2) What version of firebase-ads do you use use? Why?

3) With regard to null pointer. As I previously suggested remove all references to Kivmob from the app code and buildozer appclean, then build.

Marco Mastroeni

unread,
Nov 6, 2022, 7:58:25 PM11/6/22
to Kivy users support
1) When I was searching for documentation, today I bumped into this. It's an open issue on Kivmob, and to me seems pretty close to confirm what you said

2) I'm using "android.gradle_dependencies = 'com.google.firebase:firebase-ads:10.2.0'". Really I just copied it from kivmob tutorial.

3) I did it, and today I just recheked it after removing all code about kivmob in main.py and removing kivmob from requirements. Unfortunately nothing changes

Marco Mastroeni

unread,
Nov 12, 2022, 8:27:40 PM11/12/22
to Kivy users support
Today after the update of KivyMD to the last package the 'toast' is working (until now was crashing)
Reply all
Reply to author
Forward
0 new messages