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

Kivy app crashes after asking for permission #1019

Closed
atheistrepublic opened this issue Jan 20, 2020 · 3 comments
Closed

Kivy app crashes after asking for permission #1019

atheistrepublic opened this issue Jan 20, 2020 · 3 comments

Comments

@atheistrepublic
Copy link

atheistrepublic commented Jan 20, 2020

I have created my app using kivy and things are working good but when i add these two lines at the top of my program the app crashes after asking for permission(when i press allow).

from android.permissions import request_permissions, Permission
request_permissions([Permission.READ_EXTERNAL_STORAGE, Permission.WRITE_EXTERNAL_STORAGE])

Note that when i run buildozer android release everything works fine its just that the app crashes on android after clicking on allow.
Here is the logcat output:

01-20 20:23:18.534 1433 1819 I ActivityManager: Start proc 16676:com.google.android.packageinstaller/u0a22 for activity com.google.android.packageinstaller/com.android.packageinstaller.permission.ui.GrantPermissionsActivity caller=org.anoop.myapp
01-20 20:23:18.552 16676 16676 D TidaProvider: TidaProvider()
01-20 20:23:18.561 16676 16676 W ReflectionUtils:
01-20 20:23:18.561 16676 16676 W ReflectionUtils: java.lang.NoSuchMethodException: android.os.MessageQueue#enableMonitor()#bestmatch
01-20 20:23:18.561 16676 16676 W ReflectionUtils: at miui.util.ReflectionUtils.findMethodBestMatch(ReflectionUtils.java:338)
01-20 20:23:18.561 16676 16676 W ReflectionUtils: at miui.util.ReflectionUtils.findMethodBestMatch(ReflectionUtils.java:375)
01-20 20:23:18.561 16676 16676 W ReflectionUtils: at miui.util.ReflectionUtils.callMethod(ReflectionUtils.java:800)
01-20 20:23:18.561 16676 16676 W ReflectionUtils: at miui.util.ReflectionUtils.tryCallMethod(ReflectionUtils.java:818)
01-20 20:23:18.561 16676 16676 W ReflectionUtils: at android.os.BaseLooper.enableMonitor(BaseLooper.java:47)
01-20 20:23:18.561 16676 16676 W ReflectionUtils: at android.os.Looper.prepareMainLooper(Looper.java:112)
01-20 20:23:18.561 16676 16676 W ReflectionUtils: at android.app.ActivityThread.main(ActivityThread.java:6221)
01-20 20:23:18.561 16676 16676 W ReflectionUtils: at java.lang.reflect.Method.invoke(Native Method)
01-20 20:23:18.561 16676 16676 W ReflectionUtils: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
01-20 20:23:18.561 16676 16676 W ReflectionUtils: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
01-20 20:23:18.561 16676 16676 V BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@40f97ad
01-20 20:23:18.603 16676 16676 W System : ClassLoader referenced unknown path: /system/priv-app/GooglePackageInstaller/lib/arm64
01-20 20:23:18.611 16676 16676 W ResourceType: No package identifier when getting name for resource number 0x00000000
01-20 20:23:18.749 16676 16676 W ResourceType: No package identifier when getting name for resource number 0x00000000
01-20 20:23:18.769 16676 16676 W ResourceType: No package identifier when getting name for resource number 0x00000000
01-20 20:23:18.818 16676 16676 D AccessibilityManager: current package=com.google.android.packageinstaller, accessibility manager mIsFinalEnabled=false, mOptimizeEnabled=false, mIsUiAutomationEnabled=false, mIsInterestedPackage=false
01-20 20:23:18.824 16676 16676 V BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@d028eb
01-20 20:23:18.824 16676 16676 V BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@5db3648
01-20 20:23:18.990 16676 16692 I Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: Nondeterministic_AU_msm8937_64_LA.UM.5.5.R1__release_AU (I83a540a04a)
01-20 20:23:18.990 16676 16692 I Adreno-EGL: OpenGL ES Shader Compiler Version: XE031.09.00.04
01-20 20:23:30.229 16732 16732 I subsystem_ramdump: [arg3]: (1/0) 1: Enable qdss ramdump / 0: Disable qdss ramdump
01-20 20:23:30.230 16732 16732 E subsystem_ramdump: Directory /sdcard/ramdump does not exist
01-20 20:23:30.230 16732 16732 I subsystem_ramdump: Attemping to create /sdcard/ramdump
01-20 20:23:30.230 16732 16732 E subsystem_ramdump: Unable to create /sdcard/ramdump
01-20 20:23:30.230 16732 16732 E subsystem_ramdump: Unable to create /sdcard/ramdump
01-20 20:23:30.230 16732 16732 E subsystem_ramdump: Failed to initialize ramdump
01-20 20:23:30.218 16732 16732 W subsystem_ramdu: type=1400 audit(0.0:38110): avc: denied { search } for name="/" dev="sdcardfs" ino=102961 scontext=u:r:subsystem_ramdump:s0 tcontext=u:object_r:sdcardfs:s0 tclass=dir permissive=0
01-20 20:23:30.218 16732 16732 W subsystem_ramdu: type=1400 audit(0.0:38111): avc: denied { search } for name="/" dev="sdcardfs" ino=102961 scontext=u:r:subsystem_ramdump:s0 tcontext=u:object_r:sdcardfs:s0 tclass=dir permissive=0
01-20 20:23:30.246 1433 2942 I ActivityManager: Process com.google.process.gapps (pid 15153) has died: cch+6CE
01-20 20:23:30.249 3639 3747 D PowerKeeper.Event: notifyAMProcDied pacakageName: com.google.process.gapps, pid:15153
01-20 20:23:30.250 19224 19224 I AppBase : onTrimMemory(): 15
01-20 20:23:30.254 15082 15082 I WorkerManager: Unloading disused workers
01-20 20:23:30.321 1433 11979 I WindowManager: WIN DEATH: Window{463b712 u0 org.anoop.myapp/org.kivy.android.PythonActivity}
01-20 20:23:30.321 1433 11443 I chatty : uid=1000(system) Binder:1433_1E expire 1 line
01-20 20:23:30.321 1433 11979 W WindowManager: Force-removing child win Window{e8966a3 u0 SurfaceView - org.anoop.myapp/org.kivy.android.PythonActivity} from container Window{463b712 u0 org.anoop.myapp/org.kivy.android.PythonActivity}
01-20 20:23:30.322 1433 4412 I ActivityManager: Process org.anoop.myapp (pid 16636) has died: fore T
01-20 20:23:30.323 1433 4412 W ActivityManager: Force removing ActivityRecord{5c83162 u0 org.anoop.myapp/org.kivy.android.PythonActivity t202}: app died, no saved state
01-20 20:23:30.323 3639 3747 D PowerKeeper.Event: notifyAMProcDied pacakageName: org.anoop.myapp, pid:16636
01-20 20:23:30.327 1433 5834 W WindowManager: Failed looking up window
01-20 20:23:30.327 1433 5834 W WindowManager: java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@4f26328 does not exist
01-20 20:23:30.327 1433 5834 W WindowManager: at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:9649)
01-20 20:23:30.327 1433 5834 W WindowManager: at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:9640)
01-20 20:23:30.327 1433 5834 W WindowManager: at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:1818)
01-20 20:23:30.327 1433 5834 W WindowManager: at android.os.BinderProxy.sendDeathNotice(Binder.java:701)
01-20 20:23:30.327 1433 5834 I WindowManager: WIN DEATH: null
01-20 20:23:30.332 374 2634 E ANDR-PERF-RESOURCEQS: Failed to apply optimization [4, 0]
01-20 20:23:30.343 1433 4412 I chatty : uid=1000(system) Binder:1433_15 expire 1 line
01-20 20:23:30.347 4176 23667 D GameBoosterService: onGameStatusChange foreground:ForegroundInfo{mForegroundPackageName='com.miui.home', mForegroundUid=10026, mForegroundPid=1961, mLastForegroundPackageName='org.anoop.myapp', mLastForegroundUid=10160, mLastForegroundPid=16636, mMultiWindowForegroundPackageName='null', mMultiWindowForegroundUid=-1, mFlags=0}
01-20 20:23:30.348 1961 1961 D Launcher.Lifecycle: onStart:UserHandle{0},5e87d24,false
01-20 20:23:30.348 1629 1629 I chatty : uid=1000(system) com.android.systemui expire 210 lines
01-20 20:23:13.090 16636 16636 V pythonutil: Library loading error: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.anoop.myapp-1/base.apk"],nativeLibraryDirectories=[/data/app/org.anoop.myapp-1/lib/arm64, /data/app/org.anoop.myapp-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]] couldn't find "libpython2.7.so"
01-20 20:23:13.090 16636 16636 V pythonutil: Loading library: python3.5m
01-20 20:23:13.091 16636 16636 V pythonutil: Library loading error: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.anoop.myapp-1/base.apk"],nativeLibraryDirectories=[/data/app/org.anoop.myapp-1/lib/arm64, /data/app/org.anoop.myapp-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]] couldn't find "libpython3.5m.so"
01-20 20:23:13.091 16636 16636 V pythonutil: Loading library: python3.6m
01-20 20:23:13.094 16636 16636 V pythonutil: Library loading error: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.anoop.myapp-1/base.apk"],nativeLibraryDirectories=[/data/app/org.anoop.myapp-1/lib/arm64, /data/app/org.anoop.myapp-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]] couldn't find "libpython3.6m.so"
01-20 20:23:13.094 16636 16636 V pythonutil: Loading library: python3.7m
01-20 20:23:13.229 16636 16636 V pythonutil: Loading library: main
01-20 20:23:13.350 16636 16636 V pythonutil: Failed to load _io.so or unicodedata.so...but that's okay.
01-20 20:23:13.350 16636 16636 V pythonutil: Unsatisfied linker when loading ctypes
01-20 20:23:13.350 16636 16636 V pythonutil: Loaded everything!
01-20 20:23:13.353 16636 16636 V SDL : nativeSetupJNI()
01-20 20:23:13.354 16636 16636 V SDL : AUDIO nativeSetupJNI()
01-20 20:23:13.354 16636 16636 V SDL : CONTROLLER nativeSetupJNI()
01-20 20:23:13.370 16636 16636 D hidapi : Initializing Bluetooth
01-20 20:23:13.370 16636 16636 D hidapi : Couldn't initialize Bluetooth, missing android.permission.BLUETOOTH
01-20 20:23:13.398 16636 16636 V PythonActivity: Setting env vars for start.c and Python to use
01-20 20:23:13.398 16636 16636 V PythonActivity: Access to our meta-data...
01-20 20:23:13.400 16636 16636 I PythonActivity: Surface will NOT be transparent
01-20 20:23:13.400 16636 16636 V PythonActivity: onResume()
01-20 20:23:13.400 16636 16636 V SDL : onResume()
01-20 20:23:13.424 16636 16636 V SDL : surfaceCreated()
01-20 20:23:13.424 16636 16636 V SDL : surfaceChanged()
01-20 20:23:13.424 16636 16636 V SDL : pixel format RGB_565
01-20 20:23:13.425 16636 16636 V SDL : Window size: 720x1230
01-20 20:23:13.425 16636 16636 V SDL : Device size: 720x1280
01-20 20:23:13.451 16636 16636 V SDL : nativeResume()
01-20 20:23:13.453 16636 16668 V SDL : Running main function SDL_main from library /data/app/org.anoop.myapp-1/lib/arm64/libmain.so
01-20 20:23:13.453 16636 16668 V PythonActivity: appConfirmedActive() -> preparing loading screen removal
01-20 20:23:13.453 16636 16668 V SDL : nativeRunMain()
01-20 20:23:13.455 16636 16668 I python : Initializing Python for Android
01-20 20:23:13.455 16636 16668 I python : Setting additional env vars from p4a_env_vars.txt
01-20 20:23:13.456 16636 16668 I python : Changing directory to the one provided by ANDROID_ARGUMENT
01-20 20:23:13.456 16636 16668 I python : /data/user/0/org.anoop.myapp/files/app
01-20 20:23:13.464 16636 16668 I python : Preparing to initialize python
01-20 20:23:13.464 16636 16668 I python : _python_bundle dir exists
01-20 20:23:13.464 16636 16668 I python : calculated paths to be...
01-20 20:23:13.464 16636 16668 I python : /data/user/0/org.anoop.myapp/files/app/_python_bundle/stdlib.zip:/data/user/0/org.anoop.myapp/files/app/_python_bundle/modules
01-20 20:23:13.477 16636 16668 I python : set wchar paths...
01-20 20:23:13.639 16636 16668 I python : Initialized python
01-20 20:23:13.639 16636 16668 I python : AND: Init threads
01-20 20:23:13.641 16636 16668 I python : testing python print redirection
01-20 20:23:13.643 16636 16668 I python : Android path ['.', '/data/user/0/org.anoop.myapp/files/app/_python_bundle/stdlib.zip', '/data/user/0/org.anoop.myapp/files/app/_python_bundle/modules', '/data/user/0/org.anoop.myapp/files/app/_python_bundle/site-packages']
01-20 20:23:13.644 16636 16668 I python : os.environ is environ({'PATH': '/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin', 'DOWNLOAD_CACHE': '/data/cache', 'ANDROID_BOOTLOGO': '1', 'ANDROID_ROOT': '/system', 'ANDROID_ASSETS': '/system/app', 'ANDROID_DATA': '/data', 'ANDROID_STORAGE': '/storage', 'EXTERNAL_STORAGE': '/sdcard', 'ASEC_MOUNTPOINT': '/mnt/asec', 'BOOTCLASSPATH': '/system/framework/core-oj.jar:/system/framework/core-libart.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/apache-xml.jar:/system/framework/org.apache.http.legacy.boot.jar:/system/framework/tcmiface.jar:/system/framework/WfdCommon.jar:/system/framework/oem-services.jar:/system/framework/qcom.fmradio.jar:/system/framework/qcmediaplayer.jar:/system/framework/telephony-ext.jar:/system/app/miui/miui.apk:/system/app/miuisystem/miuisystem.apk', 'SYSTEMSERVERCLASSPATH': '/system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar', 'ANDROID_SOCKET_zygote': '8', 'ANDROID_ENTRYPOINT': 'main.pyc', 'ANDROID_ARGUMENT': '/data/user/0/org.anoop.myapp/files/app', 'ANDROID_APP_PATH': '/data/user/0/org.anoop.myapp/files/app', 'ANDROID_PRIVATE': '/data/user/0/org.anoop.myapp/files', 'ANDROID_UNPACK': '/data/user/0/org.anoop.myapp/files/app', 'PYTHONHOME': '/data/user/0/org.anoop.myapp/files/app', 'PYTHONPATH': '/data/user/0/org.anoop.myapp/files/app:/data/user/0/org.anoop.myapp/files/app/lib', 'PYTHONOPTIMIZE': '2', 'P4A_BOOTSTRAP': 'SDL2', 'PYTHON_NAME': 'python', 'P4A_IS_WINDOWED': 'True', 'P4A_ORIENTATION': 'portrait', 'P4A_NUMERIC_VERSION': 'None', 'P4A_MINSDK': '21', 'LC_CTYPE': 'C.UTF-8'})
01-20 20:23:13.644 16636 16668 I python : Android kivy bootstrap done. name is main
01-20 20:23:13.644 16636 16668 I python : AND: Ran string
01-20 20:23:13.644 16636 16668 I python : Run user program, change dir and execute entrypoint
01-20 20:23:13.931 16636 16668 I python : [WARNING] [Config ] Older configuration version detected (0 instead of 21)
01-20 20:23:13.931 16636 16668 I python : [WARNING] [Config ] Upgrading configuration in progress.
01-20 20:23:13.941 16636 16668 I python : [INFO ] [Logger ] Record log in /data/user/0/org.anoop.myapp/files/app/.kivy/logs/kivy_20-01-20_0.txt
01-20 20:23:13.941 16636 16668 I python : [INFO ] [Kivy ] v2.0.0rc1, git-Unknown, 20200103
01-20 20:23:13.942 16636 16668 I python : [INFO ] [Kivy ] Installed at "/data/user/0/org.anoop.myapp/files/app/_python_bundle/site-packages/kivy/init.pyc"
01-20 20:23:13.942 16636 16668 I python : [INFO ] [Python ] v3.7.1 (default, Jan 3 2020, 23:17:19)
01-20 20:23:13.942 16636 16668 I python : [Clang 8.0.2 (https://android.googlesource.com/toolchain/clang 40173bab62ec7462
01-20 20:23:13.942 16636 16668 I python : [INFO ] [Python ] Interpreter at "android_python"
01-20 20:23:13.943 16636 16668 I python : [INFO ] [KivyMD ] v0.102.1
01-20 20:23:13.954 16636 16668 I python : [INFO ] [Factory ] 184 symbols loaded
01-20 20:23:13.995 1609 1609 D wpa_supplicant: wlan0: Control interface command 'SIGNAL_POLL'
01-20 20:23:14.010 1609 1609 D wpa_supplicant: CTRL-DEBUG: global_ctrl_sock-sendto: sock=8 sndbuf=212992 outq=0 send_len=48
01-20 20:23:14.916 16636 16668 E linker : library "/system/lib/libc.so" ("/system/lib/libc.so") needed or dlopened by "/data/data/org.anoop.myapp/files/app/_python_bundle/modules/_ctypes.cpython-37m.so" is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="/data/app/org.anoop.myapp-1/lib/arm64:/data/app/org.anoop.myapp-1/base.apk!/lib/arm64-v8a", permitted_paths="/data:/mnt/expand:/data/data/org.anoop.myapp"]
01-20 20:23:15.138 16672 16672 I chatty : uid=1000(system) /system/bin/subsystem_ramdump expire 2 lines
01-20 20:23:15.150 16672 16672 I subsystem_ramdump: Usage:./system/bin/subsystem_ramdump [arg1] [arg2] [arg3]
01-20 20:23:15.150 16672 16672 I subsystem_ramdump: [arg1]: (1/2) Ramdump location: 1: eMMC: /data/ramdump or 2: SD card: /sdcard/ramdump
01-20 20:23:15.150 16672 16672 I subsystem_ramdump: [arg2]: (1/0) 1: Enable RPM log / 0: Disable RPM log
01-20 20:23:15.150 16672 16672 I subsystem_ramdump: [arg3]: (1/0) 1: Enable qdss ramdump / 0: Disable qdss ramdump
01-20 20:23:15.152 16672 16672 E subsystem_ramdump: Directory /sdcard/ramdump does not exist
01-20 20:23:15.152 16672 16672 I subsystem_ramdump: Attemping to create /sdcard/ramdump
01-20 20:23:15.152 16672 16672 E subsystem_ramdump: Unable to create /sdcard/ramdump
01-20 20:23:15.152 16672 16672 E subsystem_ramdump: Unable to create /sdcard/ramdump
01-20 20:23:15.152 16672 16672 E subsystem_ramdump: Failed to initialize ramdump
01-20 20:23:15.779 16636 16668 I python : [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)

@GaspHard
Copy link

Same issue here! can you help me @atheistrepublic ?

@AndreMiras AndreMiras mentioned this issue Jun 1, 2020
@Sahil-pixel
Copy link

i have also same problem..please solve this problem.

@nihilok
Copy link

nihilok commented Oct 16, 2020

You have to request permissions inside your app loop (i.e. in your on_start() method like this:

def on_start(self):
    if platform == "android":
        from android.permissions import request_permissions, Permission
        request_permissions([Permission.READ_EXTERNAL_STORAGE, Permission.WRITE_EXTERNAL_STORAGE])
    # rest of on_start() method

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

No branches or pull requests

4 participants