Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APK crashes upon launch. logcat error: null pointer dereference (occurs with imported modules) #2358

Closed
5 tasks done
shoumikdas opened this issue Nov 21, 2020 · 5 comments
Closed
5 tasks done

Comments

@shoumikdas
Copy link

shoumikdas commented Nov 21, 2020

Checklist

  • the issue is indeed a bug and not a support request
  • issue doesn't already exist: https://github.com/kivy/python-for-android/issues
  • I have a short, runnable example that reproduces the issue
  • I reproduced the problem with the latest development version (p4a.branch = develop)
  • I used the grave accent (aka backticks) to format code or logs when appropriated

Versions

  • Python: 3.8.1
  • OS: Ubuntu 18.0.4
  • Kivy: 1.11.1 / 2.0.0rc3
  • Cython: 0.29.19
  • OpenJDK: 1.8.0_275

Description

I have built a simple Kivy app with 2 screens which transition into one another at the click of a button on each screen. The screen uses canvas and colour. The apk compiles with the default buildozer spec file without any error. However, when I install the apk file on an android device, it crashes soon after the splash screen. The code uses standard Python and Kivy modules and only one custom module for checking internet connectivity. The code does not use any global variable, global function, system call or null value (None) reference. Interestingly, if I do not import any custom module, the code runs perfectly fine. But it is not possible to embed every custom module in the main python file. I have tested multiple scenarios on multiple devices and also sought help on the Kivy User Support Google Group as well but the root cause could not be identified. The code (Kivy app) runs perfectly fine without any error or warning on my Ubuntu system. Basically the first screen has a button which, when clicked, checks for internet connectivity. If a valid connection is found, it transition to the second screen. If there is no internet connection, it does nothing. The second screen has a logout button which brings the user to the first screen.

The code files are attached for reference.
screens.zip

A logcat output shows the following error:

--------- beginning of crash
11-16 09:19:19.961 2803 29315 F libc : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8 in tid 29315 (Preview3AAThrea), pid 2803 (provider@3.0-se)
11-16 09:19:20.044 31254 31254 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
11-16 09:19:20.045 31254 31254 F DEBUG : Build fingerprint: 'samsung/m10ltedd/m10lte:10/QP1A.190711.020/M105FDDU3CTI3:user/release-keys'
11-16 09:19:20.045 31254 31254 F DEBUG : Revision: '4'
11-16 09:19:20.045 31254 31254 F DEBUG : ABI: 'arm'
11-16 09:19:20.047 31254 31254 F DEBUG : Timestamp: 2020-11-16 09:19:20+0530
11-16 09:19:20.047 31254 31254 F DEBUG : pid: 2803, tid: 29315, name: Preview3AAThrea >>> /vendor/bin/hw/vendor.samsung.hardware.camera.provider@3.0-service <<<
11-16 09:19:20.047 31254 31254 F DEBUG : uid: 1047
11-16 09:19:20.047 31254 31254 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8
11-16 09:19:20.048 31254 31254 F DEBUG : Cause: null pointer dereference

11-16 09:19:20.048 31254 31254 F DEBUG : r0 00000000 r1 00000000 r2 00000001 r3 00000000
11-16 09:19:20.048 31254 31254 F DEBUG : r4 ed439a80 r5 00000000 r6 00000001 r7 e5870058
11-16 09:19:20.048 31254 31254 F DEBUG : r8 ee41f300 r9 ed439a80 r10 f064d260 r11 e5870060
11-16 09:19:20.048 31254 31254 F DEBUG : ip ef83863c sp e58681a0 lr ef7ab3cb pc ef7ab3cc
11-16 09:19:20.068 31254 31254 F DEBUG :
11-16 09:19:20.068 31254 31254 F DEBUG : backtrace:
11-16 09:19:20.068 31254 31254 F DEBUG : #00 pc 0006a3cc /vendor/lib/libexynoscamera3.so (android::ExynosCameraFrame::getFrameDoneFirstEntity(unsigned int)+12) (BuildId: a9243cc5d0a5792ad1baf4e7cb2b99ed)
11-16 09:19:20.069 31254 31254 F DEBUG : #1 pc 000be51f /vendor/lib/libexynoscamera3.so

buildozer.spec

Command:

buildozer android debug
// Keep the triple grave accent (aka backquote/backtick) to have the code formatted
buildozer -v android debug deploy run logcat > my_log.txt

Spec file:

[app]

# (str) Title of your application
title = SIVA

# (str) Package name
package.name = siva

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

# (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,ttf

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

# (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
#source.exclude_patterns = license,images/*/*.jpg

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

# (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,requests

# (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/presplash.png
presplash.filename = sivasplash.png

# (str) Icon of the application
#icon.filename = %(source.dir)s/data/icon.png
icon.filename = sivaicon.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 = #C33C23

# (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"

# (list) Permissions
#android.permissions = INTERNET

# (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 = 27

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

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

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

# (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.renpy.android.PythonActivity

# (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) Gradle dependencies to add
#android.gradle_dependencies =

# (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 =

# (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) Copy library instead of making a libpymodules.so
#android.copy_libs = 1

# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86, x86_64
android.arch = 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 =

#
# Python for android (p4a) specific
#

# (str) python-for-android fork to use, defaults to upstream (kivy)
#p4a.fork = kivy

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

# (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


#
# iOS specific
#

# (str) Path to a custom kivy-ios folder
#ios.kivy_ios_dir = ../kivy-ios
# Alternately, specify the URL and branch of a git checkout:
ios.kivy_ios_url = https://github.com/kivy/kivy-ios
ios.kivy_ios_branch = master

# Another platform dependency: ios-deploy
# Uncomment to use a custom checkout
#ios.ios_deploy_dir = ../ios_deploy
# Or specify URL and branch
ios.ios_deploy_url = https://github.com/phonegap/ios-deploy
ios.ios_deploy_branch = 1.10.0

# (bool) Whether or not to sign the code
ios.codesign.allowed = false

# (str) Name of the certificate to use for signing the debug version
# Get a list of available identities: buildozer ios list_identities
#ios.codesign.debug = "iPhone Developer: <lastname> <firstname> (<hexstring>)"

# (str) Name of the certificate to use for signing the release version
#ios.codesign.release = %(ios.codesign.debug)s


[buildozer]

# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
log_level = 2

# (int) Display warning if buildozer is run as root (0 = False, 1 = True)
warn_on_root = 1

# (str) Path to build artifact storage, absolute or relative to spec file
# build_dir = ./.buildozer

# (str) Path to build output (i.e. .apk, .ipa) storage
# bin_dir = ./bin

#    -----------------------------------------------------------------------------
#    List as sections
#
#    You can define all the "list" as [section:key].
#    Each line will be considered as a option to the list.
#    Let's take [app] / source.exclude_patterns.
#    Instead of doing:
#
#[app]
#source.exclude_patterns = license,data/audio/*.wav,data/images/original/*
#
#    This can be translated into:
#
#[app:source.exclude_patterns]
#license
#data/audio/*.wav
#data/images/original/*
#


#    -----------------------------------------------------------------------------
#    Profiles
#
#    You can extend section / key with a profile
#    For example, you want to deploy a demo version of your application without
#    HD content. You could first change the title to add "(demo)" in the name
#    and extend the excluded directories to remove the HD content.
#
#[app@demo]
#title = My Application (demo)
#
#[app:source.exclude_patterns@demo]
#images/hd/*
#
#    Then, invoke the command line with the "demo" profile:
#
#buildozer --profile demo android debug

Logs

--------- beginning of crash
11-16 09:19:19.961  2803 29315 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8 in tid 29315 (Preview3AAThrea), pid 2803 (provider@3.0-se)
11-16 09:19:20.044 31254 31254 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
11-16 09:19:20.045 31254 31254 F DEBUG   : Build fingerprint: 'samsung/m10ltedd/m10lte:10/QP1A.190711.020/M105FDDU3CTI3:user/release-keys'
11-16 09:19:20.045 31254 31254 F DEBUG   : Revision: '4'
11-16 09:19:20.045 31254 31254 F DEBUG   : ABI: 'arm'
11-16 09:19:20.047 31254 31254 F DEBUG   : Timestamp: 2020-11-16 09:19:20+0530
11-16 09:19:20.047 31254 31254 F DEBUG   : pid: 2803, tid: 29315, name: Preview3AAThrea  >>> /vendor/bin/hw/vendor.samsung.hardware.camera.provider@3.0-service <<<
11-16 09:19:20.047 31254 31254 F DEBUG   : uid: 1047
11-16 09:19:20.047 31254 31254 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8
11-16 09:19:20.048 31254 31254 F DEBUG   : Cause: null pointer dereference
11-16 09:19:20.048 31254 31254 F DEBUG   :     r0  00000000  r1  00000000  r2  00000001  r3  00000000
11-16 09:19:20.048 31254 31254 F DEBUG   :     r4  ed439a80  r5  00000000  r6  00000001  r7  e5870058
11-16 09:19:20.048 31254 31254 F DEBUG   :     r8  ee41f300  r9  ed439a80  r10 f064d260  r11 e5870060
11-16 09:19:20.048 31254 31254 F DEBUG   :     ip  ef83863c  sp  e58681a0  lr  ef7ab3cb  pc  ef7ab3cc
11-16 09:19:20.068 31254 31254 F DEBUG   : 
11-16 09:19:20.068 31254 31254 F DEBUG   : backtrace:
11-16 09:19:20.068 31254 31254 F DEBUG   :       #00 pc 0006a3cc  /vendor/lib/libexynoscamera3.so (android::ExynosCameraFrame::getFrameDoneFirstEntity(unsigned int)+12) (BuildId: a9243cc5d0a5792ad1baf4e7cb2b99ed)
11-16 09:19:20.069 31254 31254 F DEBUG   :       #01 pc 000be51f  /vendor/lib/libexynoscamera3.so (android::ExynosCamera3::m_handlePreviewFrame(android::ExynosCameraFrame*, int)+146) (BuildId: a9243cc5d0a5792ad1baf4e7cb2b99ed)
11-16 09:19:20.069 31254 31254 F DEBUG   :       #02 pc 000be2af  /vendor/lib/libexynoscamera3.so (android::ExynosCamera3::m_previewStreamFunc(android::ExynosCameraFrame*, int)+150) (BuildId: a9243cc5d0a5792ad1baf4e7cb2b99ed)
11-16 09:19:20.069 31254 31254 F DEBUG   :       #03 pc 000b22c7  /vendor/lib/libexynoscamera3.so (android::ExynosCamera3::m_previewStream3AAPipeThreadFunc()+42) (BuildId: a9243cc5d0a5792ad1baf4e7cb2b99ed)
11-16 09:19:20.069 31254 31254 F DEBUG   :       #04 pc 0006f9c1  /vendor/lib/libexynoscamera3.so (ExynosCameraThread<android::FrameWorker>::threadLoop()+22) (BuildId: a9243cc5d0a5792ad1baf4e7cb2b99ed)
11-16 09:19:20.069 31254 31254 F DEBUG   :       #05 pc 0000d8d9  /system/lib/vndk-sp-29/libutils.so (android::Thread::_threadLoop(void*)+320) (BuildId: 24ba4e12e5e4e09975ba55474dd65466)
11-16 09:19:20.069 31254 31254 F DEBUG   :       #06 pc 000a7d17  /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+20) (BuildId: 9629be880fb61625a90b250575ed6bc7)
11-16 09:19:20.069 31254 31254 F DEBUG   :       #07 pc 00061127  /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) (BuildId: 9629be880fb61625a90b250575ed6bc7)
11-19 12:32:26.799 30231 30278 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 30278 (Jit thread pool), pid 30231 (org.test.myapp)
11-19 14:01:04.564 11227 11227 E AndroidRuntime: FATAL EXCEPTION: main
11-19 14:01:04.564 11227 11227 E AndroidRuntime: Process: com.google.android.gm, PID: 11227
11-19 14:01:04.564 11227 11227 E AndroidRuntime: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{69c6eaa u0 com.google.android.gm/com.android.email.service.AttachmentService}
11-19 14:01:04.564 11227 11227 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2137)
11-19 14:01:04.564 11227 11227 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:107)
11-19 14:01:04.564 11227 11227 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:237)
11-19 14:01:04.564 11227 11227 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7948)
11-19 14:01:04.564 11227 11227 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
11-19 14:01:04.564 11227 11227 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
11-19 14:01:04.564 11227 11227 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
11-19 14:01:17.787 11358 11358 E AndroidRuntime: FATAL EXCEPTION: main
11-19 14:01:17.787 11358 11358 E AndroidRuntime: Process: com.google.android.gm, PID: 11358
11-19 14:01:17.787 11358 11358 E AndroidRuntime: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{e8162b9 u0 com.google.android.gm/com.android.email.service.AttachmentService}


@Aravind0007
Copy link

I am facing this issue as well. It is just a small application of two screens with fade transition in between with 5 buttons on first screen where one of them is copyright button which shows copyright notices in a website. I implemented it using Android-for-Python module for it which is the only button works on apk I built. Rest 4 buttons crashes showing this exception and there is a text field and FitImage widget too which was working fine. Since the button wasn't working, I cannot navigate to second screen as well. It works good on IDE. I am not sure what am I missing so. Please someone guide correct way to resolve this issue.

@Aravind0007
Copy link

I tried the build with kivy md 1.0.2 version. Its working fine now

@misl6
Copy link
Member

misl6 commented Nov 27, 2022

@shoumikdas are you still encountering this issue?

@yaitskeshav
Copy link

I am experiencing the same issue and the logs are also similar " Cause: null pointer dereference". But this problem is happening only on some devices, experienced on vivo devices specifically with android version -12 and - 13. On the other hand I am using Samsung M31s Android 12, it's working perfectly fine.

Here's the code which leads to app crash:

 ```
   BoxLayout:
              orientation: "vertical"
              padding:[0,20,0,0]
              spacing:20
              size_hint: 1, 0.1
              id:button_parent
              MDRoundFlatButton:
                  id:send_and_verify_otp
                  text:"[b][color=#cfb66e]Send OTP[/color][b]"
                  text_color: "black"
                  pos_hint: {"center_x": 0.5}
                  size_hint: 0.5, 0.5
                  font_size: sp(26)
                  markup:True
                  on_release: root.send_otp()

    MDLabel:
        size_hint: 1, 0.2
        id:instruction
        text: ""
        halign:"center"
        markup:True
        text_color:"#ff6038"   


`def send_otp(self):
        self.email = self.ids.email_and_otp_field.text
        regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'

        self.failed_login = Snackbar(
            text="",
            snackbar_x=dp(10),
            snackbar_y=dp(10),
            bg_color=(157/256, 58/256, 58/256, 1),
            duration=3
        )
        self.failed_login.size_hint_x = (
            Window.width - (self.failed_login.snackbar_x * 2)
        ) / Window.width

        if Internet:
            if len(self.email) == 0 or self.email.isspace():
                self.failed_login.text = "[b]Please Enter Email..[/b]"
                self.failed_login.open()
            elif not re.fullmatch(regex, self.email):
                self.failed_login.text = "[b]Invalid Email[/b]"
                self.failed_login.open()
            else:
                params = json.dumps(
                    {'email': self.email})
                self.ids.instruction.text="Sending OTP.."
                req=UrlRequest(URL+"api/login_via_otp", on_success=self.otp_sent_success, req_body=params,
                           on_failure=self.otp_sent_failed, on_error=self.otp_sent_failed, req_headers=headers)
        else:
            self.failed_login.text = "[b]Please Check Internet Connection![/b]"
            self.failed_login.open()

    def otp_sent_failed(self,request,result):
        self.ids.instruction.text = "Something Went Wrong ;("


    def otp_sent_success(self,request,result):

        response=result['response']
        if response == "SENT" :
            self.otp=result['CODE']
          
            self.ids.instruction.text = f"OTP Sent Successfully on : [i]{self.email}[/i] \n[size=18sp][b][color=#ff6038]Check your email for OTP[/color][/b][/size]\nEnter the OTP above. "
            self.ids.button_parent.remove_widget(self.ids.send_and_verify_otp)
            button = MDRoundFlatButton(
                text='[b][color=#cfb66e]VERIFY OTP[/color][b]', text_color= "black",pos_hint={'center_x': 0.5},size_hint= (0.5, 0.5),font_size= sp(26),markup=True)
            button.bind(on_release =self.verify_otp)
            self.ids.button_parent.add_widget(button)

            self.ids.email_otp_label.text = "Enter OTP Below"
            self.ids.email_and_otp_field.hint_text = "Enter OTP "
            self.ids.email_and_otp_field.text = ""
            self.ids.email_and_otp_field.icon_left = "key-alert"`

Whenever user clicks on Send OTP Button this code excutes successfully : `self.ids.instruction.text="Sending OTP.."` but then instantly app crashes.

@misl6
Copy link
Member

misl6 commented Feb 16, 2023

Hi @yaitskeshav !

I'm closing this issue since yours could be unrelated and the original author did not reply yet. (And some additional context was needed)

Can you please try to reduce your code to the bare minimum (also by removing KivyMD from the equation), and file a new issue if it persists?

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

No branches or pull requests

4 participants