Kivy app working on PC but not on Android with Buildozer (ACCESS_SURFACE_FLINGER denied)

1,018 views
Skip to first unread message

Ghiom

unread,
Oct 26, 2020, 3:49:14 PM10/26/20
to Kivy users support
Hi there and first of all a big thanks to all of you who helped me without knowing it. For a noob like me, those fora are really precious.

I'm new to coding, learned Python3 to see if I can, and trying to do an Android Application for my girlfriend's professionnal activity.

I scrap informations on her website (with Scrapy), put those on a JSON file, modify those a little and use Kivy and Float Layout to add them on screen. The most advanced part (for me), is a function to make a phonecall on android.

All works really good on my PC (Ubuntu or Windows), but when it come to Android, it crash at launch (after "Loading" I get a blackscreen).

First, Buildozer asked for a lot of requirements (you will see that on the .spec file), after that problem was solved, I ran on an other one with an android permission denied ACCESS_SURFACE_FLINGER. I asked with the builddozer.spec and that's not good as you can see on logs.

I also used some code to ask in my main.py

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

and it returns that Permission as no ACCESS_SURFACE_FLINGER argument.

Can you give me a hand please ? I spent 2 days searching how to make it works and my skills (and google) are not enough.

My main.py :

import kivy
kivy
.require('1.9.1')
import scrapy
import os
import json
import pprint
import webbrowser
from kivy.app import App
from kivy.config import Config  
from kivy.uix.widget import Widget
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.core.window import Window
from kivy.uix.floatlayout import FloatLayout
from scrapy.crawler import CrawlerProcess
from kivy.lang import Builder
from jnius import autoclass
from jnius import cast

Config.set('graphics', 'resizable', False)  

Builder.load_string("""
<MyLabel1>
    text_size: self.size
    shorten: False
    markup: True
    background_color: 0.7, 0.7, 0.7, .2
    canvas.before:
        Color:
            rgba: self.background_color
        Rectangle:
            pos: self.pos
            size: self.width, 92
<MyLabel2>
    text_size: self.size
    shorten: False
    markup: True
    background_color: 0.9, 0.9, 0.9, .3
    canvas.before:
        Color:
            rgba: self.background_color
        Rectangle:
            pos: self.pos
            size: self.width, 92
<MyTitle>
    markup: True
"""
)

class MyLabel1(Label):
   
"""
    A Label class with dark grey background, markups and wrapping
    """

   
pass

class MyLabel2(Label):
   
"""
    A Label class with light grey background, markups and wrapping
    """

   
pass

class MyTitle(Label):
   
"""
    A Label class with markups for the main title
    """

   
pass

class AgendaSpider(scrapy.Spider):
    name
= "agendaconceptruelle"
    start_urls
= [
       
'http://conceptruelle.fr/index.php/notre-agenda'
   
]
   
while os.path.exists('agenda.json'): os.remove('agenda.json')

   
def parse(self, response):
       
for agenda in response.css("div.title-header.ic-title-header.ic-float-left"):
           
yield {
               
'title': agenda.css("a ::text").get(),
           
}
       
for agenda in response.css("div.title-cat.ic-title-cat.ic-float-right"):
           
yield {
               
'category': agenda.css(" ::text").get(),
           
}
       
for agenda in response.css("div.nextdate.ic-next-date.ic-clearfix"):
           
yield {
               
'date': agenda.css("span ::text").get(),
           
}
       
for agenda in response.css("div.nextdate.ic-next-date.ic-clearfix"):
           
yield {
               
'time': agenda.css("span.ic-single-starttime ::text").get(),
           
}
       
for agenda in response.css("div.place.ic-place"):
           
yield {
               
'location': agenda.css(" ::text").get(),
           
}
       
for agenda in response.css("div.descshort.ic-descshort"):
           
yield {
               
'description': agenda.css(" ::text").get(),
           
}

class ConceptruelleApp(App):

   
def build(self):
       
"""
        Scrap ConcepTruelle's website agenda and put it on screen
        4 buttons give access to website, social medias and phone number
        """

       
def phonecall(self):
           
"""
            Make a Phone Call on Android with Jnius
            """

           
Intent = autoclass('android.content.Intent')
           
Uri = autoclass('android.net.Uri')          
           
PythonActivity = autoclass('org.renpy.android.PythonActivity')                                        
            intent
= Intent(Intent.ACTION_CALL)        
            intent
.setData(Uri.parse("tel:" + "0600000000"))    
            currentActivity
= cast('android.app.Activity',                                                        
               
PythonActivity.mActivity)
            currentActivity
.startActivity(intent)
         
       
def website(self):
           
"""
            Open ConcepTruelle's website
            """

            webbrowser
.open("http://conceptruelle.fr/")

       
def facebook(self):
           
"""
            Open ConcepTruelle's Facebook page
            """

            webbrowser
.open("https://www.facebook.com/ConcepTruelle")

       
def instagram(self):
           
"""
            Open ConcepTruelle's Instagram page
            """

            webbrowser
.open("https://www.instagram.com/conceptruelle")
       
       
# Main application : definition of title, labels and buttons put on a Float Layout
        fl
= FloatLayout()
        lbl0
= MyTitle(text = "  [size=28][color=000000]L\'[/color][color=dd9514][i]Agenda[/i][/color] [color=000000][b]ConcepTruelle[/b][/size][/color]", markup=True, size_hint =(1, .1), pos_hint ={'center_x':.5, 'center_y':.97})
        lbl1
= MyLabel1(text = event_title_1 + "\n" + agenda1, size_hint =(1, .5), pos_hint ={'center_x':.5, 'center_y':1.03})
        lbl2
= MyLabel2(text = event_title_2 + "\n" + agenda2, size_hint =(1, .5), pos_hint ={'center_x':.5, 'center_y':.86})
        lbl3
= MyLabel1(text = event_title_3 + "\n" + agenda3, size_hint =(1, .5), pos_hint ={'center_x':.5, 'center_y':.69})
        lbl4
= MyLabel2(text = event_title_4 + "\n" + agenda4, size_hint =(1, .5), pos_hint ={'center_x':.5, 'center_y':.52})
        lbl5
= MyLabel1(text = event_title_5 + "\n" + agenda5, size_hint =(1, .5), pos_hint ={'center_x':.5, 'center_y':.35})
        fl
.add_widget(lbl0)
        fl
.add_widget(lbl1)
        fl
.add_widget(lbl2)
        fl
.add_widget(lbl3)
        fl
.add_widget(lbl4)
        fl
.add_widget(lbl5)
        btn1
= Button(text = "Appel", size_hint =(.25, .1), pos_hint ={'center_x':.125, 'center_y':.05})
        btn1
.bind(on_press=phonecall)
        btn2
= Button(text = "Site Web", size_hint =(.25, .1), pos_hint ={'center_x':.375, 'center_y':.05})
        btn2
.bind(on_press=website)
        btn3
= Button(text = "Facebook", size_hint =(.25, .1), pos_hint ={'center_x':.625, 'center_y':.05})
        btn3
.bind(on_press=facebook)
        btn4
= Button(text = "Instagram", size_hint =(.25, .1), pos_hint ={'center_x':.875, 'center_y':.05})
        btn4
.bind(on_press=instagram)
        fl
.add_widget(btn1)
        fl
.add_widget(btn2)
        fl
.add_widget(btn3)
        fl
.add_widget(btn4)
       
return fl

if __name__ == '__main__':

   
# using Scrapy to get informations from ConcepTruelle's website and puting it in a JSON file
    process
= CrawlerProcess(settings={
       
"FEEDS": {
           
"agenda.json": {"format": "json"},
       
},
   
})
    process
.crawl(AgendaSpider)
    process
.start()
   
   
# Opening the created JSON file and using PPRINT to get strings
   
with open("agenda.json") as f:
        agenda_list
= json.load(f)
        pprint
.pprint(agenda_list)
   
   
# Modifying the JSON to fit requirements
   
for agenda_dict in agenda_list:
       
for k,v in agenda_dict.items():
           
if v is not None and k == "time":
                agenda_dict
[k] = "à " + str(agenda_dict[k])
           
if v is None:
                agenda_dict
[k] = "de 10:00 à 16:00"
           
for k,v in agenda_dict.items():
               
if k == "category" and v == "\n\t\t\t\t\tStage\t\t\t\t":
                    agenda_dict
[k] = "[color=0aa7f5]" + str(agenda_dict[k]) + "[/color]"
               
if k == "category" and v == "\n\t\t\t\t\tAtelier\t\t\t\t":
                    agenda_dict
[k] = "[color=8113bd]" + str(agenda_dict[k]) + "[/color]"
               
for k,v in agenda_dict.items():
                    agenda_dict
[k] = v.replace('\t', '')
                   
for k,v in agenda_dict.items():
                        agenda_dict
[k] = v.replace('\n', '')
   
   
# dumping the modified JSON file
   
with open('agenda.json', 'w') as outfile:
        json
.dump(agenda_list, outfile)
   
   
# creating titles and labels with the JSON informations
    event_title_1
= str("[size=18] [b]" + agenda_list[5].get("category") + "[/b] [color=000000]-[/color] [b][color=dd9514]" + str(agenda_list[0].get("title")) + "[/b][/color][/size]")
    event_title_2
= str("[size=18] [b]" + agenda_list[6].get("category") + "[/b] [color=000000]-[/color] [b][color=dd9514]" + str(agenda_list[1].get("title")) + "[/b][/color][/size]")
    event_title_3
= str("[size=18] [b]" + agenda_list[7].get("category") + "[/b] [color=000000]-[/color] [b][color=dd9514]" + str(agenda_list[2].get("title")) + "[/b][/color][/size]")
    event_title_4
= str("[size=18] [b]" + agenda_list[8].get("category") + "[/b] [color=000000]-[/color] [b][color=dd9514]" + str(agenda_list[3].get("title")) + "[/b][/color][/size]")
    event_title_5
= str("[size=18] [b]" + agenda_list[9].get("category") + "[/b] [color=000000]-[/color] [b][color=dd9514]" + str(agenda_list[4].get("title")) + "[/b][/color][/size]")
    agenda1
= str("[color=000000][i] " + str(agenda_list[25].get("description")) + "[/i]\n Le " + str(agenda_list[10].get("date")) + " " + str(agenda_list[15].get("time")) + "\n Lieu : " + str(agenda_list[20].get("location")) + "[/color]")
    agenda2
= str("[color=000000][i] " + str(agenda_list[26].get("description")) + "[/i]\n Le " + str(agenda_list[11].get("date")) + " " + str(agenda_list[16].get("time")) + "\n Lieu : " + str(agenda_list[21].get("location")) + "[/color]")
    agenda3
= str("[color=000000][i] " + str(agenda_list[27].get("description")) + "[/i]\n Le " + str(agenda_list[12].get("date")) + " " + str(agenda_list[17].get("time")) + "\n Lieu : " + str(agenda_list[22].get("location")) + "[/color]")
    agenda4
= str("[color=000000][i] " + str(agenda_list[28].get("description")) + "[/i]\n Le " + str(agenda_list[13].get("date")) + " " + str(agenda_list[18].get("time")) + "\n Lieu : " + str(agenda_list[23].get("location")) + "[/color]")
    agenda5
= str("[color=000000][i] " + str(agenda_list[29].get("description")) + "[/i]\n Le " + str(agenda_list[14].get("date")) + " " + str(agenda_list[19].get("time")) + "\n Lieu : " + str(agenda_list[24].get("location")) + "[/color]")
   
   
# Define main window's background color
   
Window.clearcolor = (1, 1, 1, 1)
   
   
# Call the main application
   
ConceptruelleApp().run()

My buildozer.spec :

[app]

# (str) Title of your application
title
= ConcepTruelle

# (str) Package name
package.name = conceptruelle

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

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

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

# (list) List of exclusions using pattern matching
#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,hostpython3,kivy==master,scrapy,jnius,pyjnius,requests,simplejson,openssl,android,prettyprinter,twisted,w3lib,attrs,lxml,parsel,cssselect,itemadapter,cryptography,pyopenssl,zlib_wrapper,macholib,pydispatch,pydispatcher,libxslt,libxml2,service_identity,pyasn1,pyasn1_modules,google-auth-oauthlib,android.permissions

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

# (list) Garden requirements
#garden_requirements =

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

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

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

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

# (list) Permissions
android
.permissions = ACCESS_SURFACE_FLINGER,INTERNET,ACCEPT_HANDOVER,BROADCAST_STICKY,PROCESS_OUTGOING_CALLS,ACTIVITY_RECOGNITION,WRITE_EXTERNAL_STORAGE

# (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 (currently works only with sdl2_gradle
# bootstrap)
#android.add_aars =

# (list) Gradle dependencies to add (currently works only with sdl2_gradle
# bootstrap)
#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_gradle_repositories =

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

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


#
# 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.7.0

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

What seems to be the problematic part of my logs when doing
buildozer -v android debug deploy run logcat > my_log.txt

10-26 17:12:09.463  9229  9229 V SDL     : nativeSetupJNI()
10-26 17:12:09.466  9229  9229 V SDL     : AUDIO nativeSetupJNI()
10-26 17:12:09.468  9229  9229 V SDL     : CONTROLLER nativeSetupJNI()
10-26 17:12:09.494  9229  9229 D hidapi  : Initializing Bluetooth
10-26 17:12:09.495  9229  9229 D hidapi  : Couldn't initialize Bluetooth, missing android.permission.BLUETOOTH
10-26 17:12:09.525  9229  9229 V PythonActivity: Setting env vars for start.c and Python to use
10-26 17:12:09.525  9229  9229 V PythonActivity: Access to our meta-data...
10-26 17:12:09.529  9229  9229 I PythonActivity: Surface will NOT be transparent
10-26 17:12:09.529  9229  9229 V PythonActivity: onResume()
10-26 17:12:09.530  9229  9229 V SDL     : onResume()
10-26 17:12:09.557   604   942 W ServiceManager: Permission failure: android.permission.ACCESS_SURFACE_FLINGER from uid=10182 pid=9229
10-26 17:12:09.558   604   942 D PermissionCache: checking android.permission.ACCESS_SURFACE_FLINGER for uid=10182 => denied (814 us)
10-26 17:12:09.562  9229  9229 V SDL     : surfaceCreated()
10-26 17:12:09.562  9229  9229 V SDL     : surfaceChanged()
10-26 17:12:09.563  9229  9229 V SDL     : pixel format RGB_565
10-26 17:12:09.565  9229  9229 V SDL     : Window size: 1080x1731
10-26 17:12:09.565  9229  9229 V SDL     : Device size: 1080x1920
10-26 17:12:09.578  9229  9229 V SDL     : nativeResume()
10-26 17:12:09.579  9229  9326 V SDL     : Running main function SDL_main from library /data/app/org.conceptruelle.conceptruelle-OBg7Tkf0OmcdRT4L0eMfDQ==/lib/arm/libmain.so
10-26 17:12:09.579  9229  9326 V PythonActivity: appConfirmedActive() -> preparing loading screen removal
10-26 17:12:09.580  9229  9326 V SDL     : nativeRunMain()
10-26 17:12:09.582  9229  9326 I python  : Initializing Python for Android
10-26 17:12:09.582  9229  9326 I python  : Setting additional env vars from p4a_env_vars.txt
10-26 17:12:09.583  9229  9326 I python  : Changing directory to the one provided by ANDROID_ARGUMENT
10-26 17:12:09.583  9229  9326 I python  : /data/user/0/org.conceptruelle.conceptruelle/files/app
10-26 17:12:09.584  9229  9326 I python  : Preparing to initialize python
10-26 17:12:09.584  9229  9326 I python  : _python_bundle dir exists
10-26 17:12:09.585  9229  9326 I python  : calculated paths to be...
10-26 17:12:09.585  9229  9326 I python  : /data/user/0/org.conceptruelle.conceptruelle/files/app/_python_bundle/stdlib.zip:/data/user/0/org.conceptruelle.conceptruelle/files/app/_python_bundle/modules
10-26 17:12:09.590  9229  9326 I python  : set wchar paths...
10-26 17:12:09.730  9229  9326 I python  : Initialized python
10-26 17:12:09.730  9229  9326 I python  : AND: Init threads
10-26 17:12:09.734  9229  9326 I python  : testing python print redirection
10-26 17:12:09.738  9229  9326 I python  : Android path ['
.', '/data/user/0/org.conceptruelle.conceptruelle/files/app/_python_bundle/stdlib.zip', '/data/user/0/org.conceptruelle.conceptruelle/files/app/_python_bundle/modules', '/data/user/0/org.conceptruelle.conceptruelle/files/app/_python_bundle/site-packages']
10-26 17:12:09.739  9229  9326 I python  : os.environ is environ({'
PATH': '/sbin:/system/sbin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/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/bouncycastle.jar:/system/framework/apache-xml.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/android.hidl.base-V1.0-java.jar:/system/framework/android.hidl.manager-V1.0-java.jar:/system/framework/framework-oahl-backward-compatibility.jar:/system/framework/android.test.base.jar:/system/framework/telephony-ext.jar', 'SYSTEMSERVERCLASSPATH': '/system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar:/system/framework/com.android.location.provider.jar', 'ANDROID_SOCKET_zygote_secondary': '11', 'ANDROID_ENTRYPOINT': 'main.pyc', 'ANDROID_ARGUMENT': '/data/user/0/org.conceptruelle.conceptruelle/files/app', 'ANDROID_APP_PATH': '/data/user/0/org.conceptruelle.conceptruelle/files/app', 'ANDROID_PRIVATE': '/data/user/0/org.conceptruelle.conceptruelle/files', 'ANDROID_UNPACK': '/data/user/0/org.conceptruelle.conceptruelle/files/app', 'PYTHONHOME': '/data/user/0/org.conceptruelle.conceptruelle/files/app', 'PYTHONPATH': '/data/user/0/org.conceptruelle.conceptruelle/files/app:/data/user/0/org.conceptruelle.conceptruelle/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'})
10-26 17:12:09.742  9229  9326 I python  : Android kivy bootstrap done. __name__ is __main__
10-26 17:12:09.743  9229  9326 I python  : AND: Ran string
10-26 17:12:09.743  9229  9326 I python  : Run user program, change dir and execute entrypoint
10-26 17:12:10.081  9229  9326 I python  : [WARNING] [Config      ] Older configuration version detected (0 instead of 21)
10-26 17:12:10.081  9229  9326 I python  : [WARNING] [Config      ] Upgrading configuration in progress.
10-26 17:12:10.102  9229  9326 I python  : [INFO   ] [Logger      ] Record log in /data/user/0/org.conceptruelle.conceptruelle/files/app/.kivy/logs/kivy_20-10-26_0.txt
10-26 17:12:10.104  9229  9326 I python  : [INFO   ] [Kivy        ] v1.11.1
10-26 17:12:10.105  9229  9326 I python  : [INFO   ] [Kivy        ] Installed at "/data/user/0/org.conceptruelle.conceptruelle/files/app/_python_bundle/site-packages/kivy/__init__.pyc"
10-26 17:12:10.107  9229  9326 I python  : [INFO   ] [Python      ] v3.8.1 (default, Oct 26 2020, 11:01:07)
10-26 17:12:10.107  9229  9326 I python  : [Clang 8.0.2 (https://android.googlesource.com/toolchain/clang 40173bab62ec7462
10-26 17:12:10.109  9229  9326 I python  : [INFO   ] [Python      ] Interpreter at ""
10-26 17:12:10.111  9229  9326 I python  : [INFO   ] [Logger      ] Purge log fired. Analysing...
10-26 17:12:10.113  9229  9326 I python  : [INFO   ] [Logger      ] Purge finished!
10-26 17:12:14.439  9229  9326 I python  : [INFO   ] [Factory     ] 184 symbols loaded
10-26 17:12:15.352  9229  9326 I python  : [INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
10-26 17:12:15.436  9229  9326 I python  : [INFO   ] [Text        ] Provider: sdl2
10-26 17:12:15.520  9229  9326 I python  : [INFO   ] [Window      ] Provider: sdl2
10-26 17:12:15.573  9229  9326 E libEGL  : validate_display:92 error 3008 (EGL_BAD_DISPLAY)
10-26 17:12:15.575  9229  9326 V SDL     : setOrientation() orientation=-1 width=800 height=600 resizable=true hint=
10-26 17:12:15.593  9229  9326 I python  : [INFO   ] [GL          ] Using the "OpenGL ES 2" graphics system
10-26 17:12:15.597  9229  9326 I python  : [INFO   ] [GL          ] Backend used <sdl2>
10-26 17:12:15.599  9229  9326 I python  : [INFO   ] [GL          ] OpenGL version <b'
OpenGL ES 3.2 V@258.0 (GIT@8e59954, I0be83d0d26) (Date:09/22/17)'>
10-26 17:12:15.600  9229  9326 I python  : [INFO   ] [GL          ] OpenGL vendor <b'
Qualcomm'>
10-26 17:12:15.602  9229  9326 I python  : [INFO   ] [GL          ] OpenGL renderer <b'
Adreno (TM) 418'>
10-26 17:12:15.604  9229  9326 I python  : [INFO   ] [GL          ] OpenGL parsed version: 3, 2
10-26 17:12:15.606  9229  9326 I python  : [INFO   ] [GL          ] Texture max size <16384>
10-26 17:12:15.607  9229  9326 I python  : [INFO   ] [GL          ] Texture max units <16>
10-26 17:12:15.724  9229  9326 I python  : [INFO   ] [Window      ] auto add sdl2 input provider
10-26 17:12:15.727  9229  9326 I python  : [INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
10-26 17:12:15.855  9229  9326 I python  :  Traceback (most recent call last):
10-26 17:12:15.857  9229  9326 I python  :  2020-10-26 17:12:15 [kivy] WARNING: stderr: Traceback (most recent call last):
10-26 17:12:15.858  9229  9326 I python  :  2020-10-26 17:12:15 [kivy] WARNING: stderr: 2020-10-26 17:12:15 [kivy] WARNING: stderr: Traceback (most recent call last):





Robert Flatt

unread,
Oct 26, 2020, 5:02:57 PM10/26/20
to Kivy users support
I ran on an other one with an android permission denied ACCESS_SURFACE_FLINGER. I asked with the builddozer.spec and that's not good as you can see on logs.

I also used some code to ask in my main.py

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

and it returns that Permission as no ACCESS_SURFACE_FLINGER argument.


I suspect ACCESS_SURFACE_FLINGER is not the issue. Why are you asking for it in the .spec ?

The first issue is probably what is shown in the Traceback, but the log shown is truncated.
If you don't understand the Traceback, post the FULL Traceback here, all of the Traceback is important but the last line is the most important.

There is some unusual stuff here, I wonder how this story will unfold?

Ghiom

unread,
Oct 27, 2020, 3:53:37 AM10/27/20
to Kivy users support
Thx for your response !

I asked for the permission cause my logs shown me that permission was needed.

I'll show you the logs, but they are huge, that's why I troncated them (that was apparently a bad idea).

Really thanks for your help, I'm clearly out of my league :D
my_log.txt

Robert Flatt

unread,
Oct 27, 2020, 1:50:34 PM10/27/20
to Kivy users support
The size of the log is not an issue, attaching as .txt is definately the right way to share.

Some unusual stuff here, so by suggestions will contain "probably" - validate with small test cases.

At the end of the Traceback we see:
WARNING: stderr: 2020-10-27 08:45:24 [kivy] WARNING: stderr: 2020-10-27 08:45:24 [kivy] WARNING: stderr: 2020-10-27
10-27 08:45:24.818 15914 16036 I python  : Python for android ended.
10-27 08:45:25.432 15914 15926 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x1c in tid 15926 (Jit thread pool), pid 15914 (e.conceptruelle)
10-27 08:45:25.505 16050 16050 F crash_dump32: crash_dump.cpp:335] failed to open /proc/15914: No such file or directory
10-27 08:45:25.515   851  2552 I WindowManager: WIN DEATH: Window{a1c1838 u0 org.conceptruelle.conceptruelle/org.kivy.android.PythonActivity}

Several things,
1) this message is coming from Java code; either it is the pyjnius code (I don't think so - but test this by removing it) or it is Android is being asked to do somthing it can't do.
2) the repeated WARNING:stderr is weird.
3) the error looks to be "failed to open /proc/15914". On Android creating a process (presumably with exec()) is probably going to fail because Android is not POSIX

Some possibilities (my guess the issue is A), but ....):
A) that exec() is in the webbrowser package, and uses an exec() to start a third party webbrowser - and depends on POSIX.
Test this by creating a HelloWorld app, add two things: import webrowser and in on_start() put webbrowser.open().  Does this crash in the same way?

B) process = CrawlerProcess(s
Try commenting this. Also move it to on_start()

It is possible webbrowser/scrapy is not going to work. Look at beautifulsoup4, does that do what you want? Avoid diapointment try a small test case first.


I asked for the permission cause my logs shown me that permission was needed.

We should look at this later. 
You need INTERNET, WRITE_EXTERNALSTORAGE, and whatever the phone needs.
The requirements can be trimmed too.

Ghiom

unread,
Oct 28, 2020, 4:56:05 AM10/28/20
to Kivy users support
Hi Robert and thanks for all your help.

I've done multiple tests like you asked (on new apps and on my project), and the problem seems to be with Scrapy. If I comment all the scrapy stuff and put a handmade agenda_list[] the application launch. The webbrowser buttons are working.

So... without Scrapy my app is useless... I need to find something else. I'll look on Beautifullsoup I think.

Other than that, the "Call" button doesn't work so Jnius isn't doing his job or maybe I lack a permission for that on Android ? I asked for CALL_PHONE, but it didn't work and it seems that Jnius is having a problem with the PythonActivity Class.

I give you some logs attached.

Thanks again.
logs_no_scrapy.txt
logs_no_scrapy_browser.txt
logs_no_webbrowser.txt
logs_phone_call_crash.txt

Robert Flatt

unread,
Oct 28, 2020, 4:17:08 PM10/28/20
to Kivy users support
Try starting scrappy in a thread rather than a process, if it works on the desktop it will work on Android.

10-28 09:27:10.907 27603 27701 I python  :  jnius.jnius.JavaException: Class not found b'org/renpy/android/PythonActivity'
10-28 09:27:10.908 27603 27701 I python  : Python for android ended.
This should be "org.kivy.android. "  not "org.renpy.android. "   - obsolete documentaion

I'll be interested to know if webbrowser works.....

Ghiom

unread,
Nov 4, 2020, 6:07:23 AM11/4/20
to Kivy users support
Hi and sorry for not showing signs of life those days, computer issues.
Scrapy was a problem, so I used beautifulsoup4 instead and now it works (I had a problem with htlmparser, but fixed with that workaround : https://stackoverflow.com/questions/23952484/buildozer-compiles-apk-but-it-crashes-on-android )

For jnius, I recently discovered plyer and it's way simpler to use. I can't manage to do a phone call with it (my application crash when I clic on it), but this way my application works on my phone.

I have graphic issues (text is not showing at the good size for titles and some squares on background are 1/5 the size shown on PC), the "Call" button don't work, but all the other stuffs are functionnal.

I put the main.py, buildozer.spec and modified htmlparser in attachment if you wan't to see.
Any help will be appreciated with my plyer issue.

Really thanks for your help Robert, was really kind of you to take time for a newbie like me :)
buildozer.spec
_htmlparser.py
main.py

Robert Flatt

unread,
Nov 4, 2020, 11:43:08 AM11/4/20
to Kivy users support
Give yourself a reward, you debugged some difficult stuff, and showed flexibility in finding solutions. Cool.
...
Reply all
Reply to author
Forward
0 new messages