title: How do you create a kivy apk from a package?
body: <p>I have a simple python/kivy package from which I wish to create an android APK using Buildozer. The package from the root is organised as:</p>
  
  <pre><code>.
  ├── bin
  │   ├── kivy_test-0.1-debug.apk
  │   └── myapp-0.1-debug.apk
  ├── buildozer.spec
  ├── __init__.py
  └── kivy_app
      ├── __init__.py
      ├── __main__.py
      └── source
          ├── main.py
          └── version.py
  </code></pre>
  
  <p>The module main.py is:</p>
  
  <pre><code>from kivy.app import App
  from kivy.uix.screenmanager import Screen
  from kivy.uix.button import Label
  from kivy.lang import Builder
  
  from version import VERSION
  
  root = Builder.load_string('''
  &lt;MainFrame&gt;:
      BoxLayout:
          orientation: 'vertical'
          Label:
              text: 'Hola mundo!'
          Label:
              text: root.version
  ''')
  
  class MainFrame(Screen):
      version = 'Version: %s' % VERSION
      def __init__(self, **kwargs):
          super(MainFrame, self).__init__(**kwargs)
  
  class BasicApp(App):
      def build(self):
          return MainFrame()
  
  if __name__ == '__main__':
      BasicApp().run()
  </code></pre>
  
  <p>version.py is</p>
  
  <pre><code>__all__ = 'VERSION'
  
  VERSION = '0.0.2'
  </code></pre>
  
  <p>and <code>_</code><em>main<code>_</code></em>.py is</p>
  
  <pre><code>from .source.main import BasicApp
  
  def main():
      BasicApp().run()
  
  if __name__ == "__main__":
      main()
  </code></pre>
  
  <p>The problem that I have is that when I run the module by typing</p>
  
  <pre><code>python -m kivy_app
  </code></pre>
  
  <p>in the root directory I need to have  the line </p>
  
  <pre><code>from .version import VERSION
  </code></pre>
  
  <p>in main.py (note there is '.' before version).</p>
  
  <p>On the other hand, when I build the android apk from the root directory the buildozer.spec uses the line:</p>
  
  <pre><code># (str) Source code where the main.py live
  source.dir = ./kivy_app/source
  </code></pre>
  
  <p>and of course it is invoking the lines:</p>
  
  <pre><code>if __name__ == '__main__':
       BasicApp().run()
  </code></pre>
  
  <p>in main.py.</p>
  
  <p>In this case the module is treated as if it is not in a package and so needs the line:</p>
  
  <pre><code>from version import VERSION
  </code></pre>
  
  <p>(In this case no '.' before version in the import statement)</p>
  
  <p>How can I resolve this conflict?</p>