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

AsyncImage not loading in .apk #433

Closed
neutralboy opened this issue Dec 5, 2016 · 2 comments
Closed

AsyncImage not loading in .apk #433

neutralboy opened this issue Dec 5, 2016 · 2 comments

Comments

@neutralboy
Copy link

The Async image works well on my LinuxMint 32-bit, but fails to load on my Android device.

The permissions in the Builder.spec file has been written as INTERNET but in the deployed apk, it does mention any other permissions other than "Read and modify contents of SD card"!

My code

`from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.image import Image, AsyncImage

Builder.load_string("""

<screen1>:
    Calcu:
        rows:6 
        id: calculator
        display: entry

        
        BoxLayout:
            TextInput:
                id: entry
            
        BoxLayout:
            Button:
                text:"7"
                on_press: entry.text += self.text
                font_size:32
            Button:
                text:"8"
                on_press: entry.text += self.text
                font_size:32
            Button:
                text:"9"
                font_size:32        
                on_press: entry.text += self.text
            Button:
                font_size:32
                text:"+"
                on_press: entry.text += self.text
        BoxLayout:
            Button:
                font_size:32
                text:"4"
                on_press: entry.text += self.text
            Button:
                font_size:32
                text:"5"
                on_press: entry.text += self.text
            Button:
                font_size:32
                text:"6"
                on_press: entry.text += self.text
            Button:
                font_size:32            
                text:"-"
                on_press: entry.text += self.text
        BoxLayout:
            Button:
                font_size:32  
                text:"1"
                on_press: entry.text += self.text
            Button:
                font_size:32  
                text:"2"
                on_press: entry.text += self.text
            Button:
                font_size:32  
                text:"3"
                on_press: entry.text += self.text
            Button:
                font_size:32  
                text:"*"
                on_press: entry.text += self.text
            
        BoxLayout:
            Button:
                font_size:32  
                text:"0"
                on_press: entry.text += self.text
            Button:
                font_size:32  
                text:"."
                on_press: entry.text += self.text
            Button:
                font_size:32  
                text:"="
                on_press: calculator.calculate(entry.text)
            Button:
                font_size:32  
                text:"/"
                on_press: entry.text += self.text
        BoxLayout:
            Button:
                text:"AC"
                on_press: entry.text = ""
            Button:
                text: "Credits"
                on_release: root.manager.current = 'screen2'
                size_hint: 0.2, 1
                
<screen2>:
    FloatLayout:
        Label:
            text: "                This is my way of greeting you on this day, the occasion of your birthday!!.May joy, peace, happiness and sucess be with you forever."
            pos_hint: {"x":0.0, 'y':0.1}
            font_size: 25
            size_hint_y: None
            text_size: self.width, None
            height: self.texture_size[1]
        Button:
            text: "get back!!"
            on_release: root.manager.current = 'screen1'
            size_hint: 0.2, 0.1
            pos_hint:{"x":0.35, 'y':0}
        AsyncImage:
            source: 'http://i.imgur.com/****.png'
            ## I know the right URL I dont wanna reveal it
            pos_hint: {"x":0, 'y':0.1}
        
        
""")

class screen1(Screen):
    pass
class screen2(Screen):
    pass

class Calcu(GridLayout):
    def calculate(self,calculation):
        if calculation:
            try:
                self.display.text = str(eval(calculation))
            except Exception :
                self.display.text = "Error"

sm = ScreenManager()
sm.add_widget(screen1(name="screen1"))
sm.add_widget(screen2(name="screen2"))

class main(App):
        def build(self):
            return sm
        
main().run()

My Buildozer.spec is located at http://dpaste.com/3F9WGSX

I tried adding "openssl" also to the permissions but the app crashed when deployed

Any Help would be appreciated!

@inclement
Copy link
Member

Closing as stale, if it still occurs then please open a python-for-android issue about it including the buildozer android logcat output.

@jbsidis
Copy link

jbsidis commented Sep 19, 2020

The issue is that, the Kivy or Kivymd module added to your apk distribution is a version that has issues, make sure you place the master branch requirement for kivymd in the spec file in your requirements,

Then, AsyncImage sometimes needs to be under and Image class or from an Image object class, so that will help the program to understand, your are trying to display an image:

class Image45(IconLeftWidget):
pass

Kv = """
:
AsyncImage:
source: root.url #this should be an url

Screen:
ScreenManager:
Screen:
MDToolbar:
title: "Hello"
BoxLayout:
Image45:
"""

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

3 participants