1

I made a test application on kivy to call a service. I have these files: main.py

from kivy.app import App
from kivy.uix.button import Button
from jnius import autoclass


class TestButton(Button): 
    # When the button is pressed, this function is called
    def run_test_service(self):
        service = autoclass('org.test.myapp.ServiceMyservice')
        mActivity = autoclass('org.kivy.android.PythonActivity').mActivity
        argument = ""
        service.start(mActivity, argument)


class ServiceTestApp(App):
    def build(self):
        return TestButton()


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

buildozer.spec

[app]

# (str) Title of your application
title = My Application

# (str) Package name
package.name = myapp

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

...
# (list) List of service to declare
#services = Myservice:main.py

As a result, I get the error:

jnius.jnius.JavaException: Class not found b'org/test/myapp/ServiceMyservice

I used these resources to use the service: This site and This site.

If I change package name and package domain to

# (str) Package name
package.name = oscservice

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

and

service = autoclass('org.kivy.oscservice.ServiceMyservice')

The problem is solved in debug mode. But when I want get release file, I have this Error in terminal:

# ERROR: Trying to release a package that starts with org.kivy
#
# The package.domain org.kivy is reserved for the Kivy official
# applications. Please use your own domain.
#
# If you are a Kivy developer, add an export in your shell
# export BUILDOZER_ALLOW_KIVY_ORG_DOMAIN=1

What should I specify in the service argument to access the service script? I'd be grateful if you could show me the way that brings me closer to the answer.

1 Answers1

0

You need to uncomment the buildozer line where you declare services of you keep them commented how is it possible to access the service

Change

#services = Myservice:main.py 

To

services = Myservice:main.py