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 Immediately Closes After Opening in Debug, Release, and Zipaligned & Signed Versions #1242

Closed
hebozhe opened this issue Feb 27, 2018 · 1 comment

Comments

@hebozhe
Copy link

hebozhe commented Feb 27, 2018

Thanks, all, for your help thus far. It's been great!

I built the APK from the Buildozer VM, and correctly zipaligned and signed it for Android, but it never runs. It only shows the Kivy load screen, and then closes instantly:

  • The debug APK crashes when loaded manually onto my phone.
  • The unsigned release APK crashes when loaded manually onto my phone.
  • The zipaligned and signed release APK crashes when loaded manually onto my phone.

So I'm thinking there's something wrong with my source code, but I can't see what.

The main.py perfectly fine through PyCharm, and here are its main specs:

  • My app's PyCharm interpreter runs Miniconda 2 with Python 2.7.9.
  • Below is a screenshot of the file with the most dependencies:

new bitmap image

  • My buildozer.spec only has these listed module requirements:
# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = gTTS,stringdist,kivy
  • It also includes the following source files:
# (list) Source files to include (let empty to include all the files)
source.include_exts = csv,txt,otf,ttc,ttf,mp3,py,png,jpg,kv,atlas

The only part with the kivy App installed (the remaining files just contains dictionaries, classes, and layouts) is my main.py. Its source code is below:

# coding=utf-8
import kivy
import settings
import progress
kivy.require("1.10.0")
from kivy.app import App
from kivy.core.text import LabelBase
from kivy.uix.screenmanager import Screen, ScreenManager, FadeTransition
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout

# Import all the fonts you'll need.
LabelBase.register(name="NotoSans",
                   fn_regular="Fonts/NotoSans-Regular.ttf",
                   fn_bold="Fonts/NotoSans-Bold.ttf",
                   fn_bolditalic="Fonts/NotoSans-BoldItalic.ttf",
                   fn_italic="Fonts/NotoSans-Italic.ttf")
LabelBase.register(name="AdobeDev",
                   fn_regular="Fonts/AdobeDevanagari-Regular.otf",
                   fn_bold="Fonts/AdobeDevanagari-Bold.otf",
                   fn_bolditalic="Fonts/AdobeDevanagari-BoldItalic.otf",
                   fn_italic="Fonts/AdobeDevanagari-Italic.otf")
LabelBase.register(name="MSYahei",
                   fn_regular="Fonts/msyh.ttc",
                   fn_bold="Fonts/msyhbd.ttc",
                   fn_bolditalic="Fonts/msyhbd.ttc",
                   fn_italic="Fonts/msyhl.ttc")

class screenBtns(BoxLayout):
    def __init__(self, **kwargs):

        super(screenBtns, self).__init__(**kwargs)
        def changePage(self):
            root.clear_widgets()
            root.add_widget(settingsScreen(name="stngsScrn"))
            root.add_widget(progressScreen(name="progsScrn"))
            root.current = str(self.id + "Scrn")

        self.orientation = "horizontal"
        self.size_hint = (1, .05)
        progsBtn = Button(id="progs", text="Language Progress")
        progsBtn.bind(on_release=changePage)
        self.add_widget(progsBtn)
        stngsBtn = Button(id="stngs", text="Settings & More")
        stngsBtn.bind(on_release=changePage)
        self.add_widget(stngsBtn)

class settingsScreen(Screen):
    def __init__(self, **kwargs):

        super(settingsScreen, self).__init__(**kwargs)
        box_lay = BoxLayout(orientation="vertical")
        box_lay.add_widget(screenBtns())
        box_lay.add_widget(settings.settings())
        self.add_widget(box_lay)

class progressScreen(Screen):
    def __init__(self, **kwargs):

        super(progressScreen, self).__init__(**kwargs)
        box_lay = BoxLayout(orientation="vertical")
        box_lay.add_widget(screenBtns())
        box_lay.add_widget(progress.progress())
        self.add_widget(box_lay)

root = ScreenManager(transition=FadeTransition())
root.add_widget(progressScreen(name="progsScrn"))
root.add_widget(settingsScreen(name="stngsScrn"))
root.current = "progsScrn"

class mainApp(App):
    def build(self):
        return root

if __name__ == "__main__":
    mainApp().run()

I tried the "run logcat" command from the Buildozer VM, but it doesn't throw any errors. It just says it succeeded, doesn't display, and then closes. I also tried to load it onto an Android Studio Emulator for two different types of phones and software packs, and it didn't load, either. Instead it states that there's an "error parsing package".

I only loaded the APK, none of its subfolders or other py files, when I tried running it.

Any ideas what could be going wrong?

@inclement
Copy link
Member

Closing as the same issue as kivy/buildozer#629, with the same response.

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

2 participants