A service that executes binaries for Kodi's addon Elementum on Android without a W^X violation.
Update: The service should no longer be necessary for newer versions of Elementum as they fallback to loading binaries in the same process if they cannot start a new one. This project will be maintained in case something else comes up.
Use source https://StefanIlchev.github.io/ElementumService.
Install an .apk
with an Application Binary Interface (ABI) that your device supports or the bigger universal one.
Add Elementum to Kodi from the .android_client.zip
. When the addon completes installation, it will start the service app which may ask you for some Android permissions.
On Android 11 and up the service app may ask you to allow it to manage all files or try to open its settings if your device does not let it. If nothing else works the service app will show you the following command that will allow it to manage all files which you might have to execute for Elementum to work properly:
adb shell appops set service.elementum.android MANAGE_EXTERNAL_STORAGE allow
Reinstall the addon from the added Elementum Service Repository
and Kodi should keep it up to date. If you do not see the repository as an option check if it is not disabled.
When updating itself the service app might ask you to allow it to install apps and to confirm the update. After an update the service will not be started automatically. A start can be triggered by interacting with the addon which will try to start the service if it is not responding.
The service app will not work if it is a different version from the addon and will show a message like:
<service-version> ≠ <client-version>
Prepare an Elementum addon .zip
at path/to/plugin.video.elementum-<version>.zip
containing Android binaries for your device either by building the Elementum project or by downloading it from a release's assets.
Assuming you already have Android Studio setup, execute the following command in a terminal:
gradlew clean assembleRelease zipAndroidClient -p ElementumService -Delementum.addon.zip="path/to/plugin.video.elementum-<version>.zip"
and when it completes successfully look for the following files in the newly created ElementumService/build
folder:
-
plugin.video.elementum-<version>.android_client.zip
found directly in theElementumService/build
folder is the addon.zip
you provided with its binaries removed and scripts modified to work with the service app; -
ElementumService-<ABI>-release-<version>.apk
found in theElementumService/build/outputs/apk/release
subfolder are one or more.apk
files containing the binaries from the addon.zip
you provided.
-
From now on when Elementum starts its daemon it will start the service app and when it stops it will stop the service app.
-
You will no longer be able to use paths to Kodi's data folder as they will be translated to the service app's data folder.
-
The output from the binaries will no longer appear in Kodi's log and will go to Android's log instead.