Android Build binary addon package for Android with the right structure
#1
Dear developers,

I managed to cross-compiling a pvr binary addon for Leia using ndk 20b and the latest command line sdk tools as suggested in the README.Android.md file.

 - commandlinetools-linux-6200805_latest.zip
 - android-ndk-r20b-linux-x86_64.zip

I think in the latest sdk version the structure of the package has changed and to avoid the error "configure: error: verify sdk path" I had to adapt the configure file to let the script finding the correct path (I have mainly taken the one from Master + local modification that are explained later).

I managed to compile successfully the addon for Android Oreo 8.0 API level 26 but I have had only one issue:

cd $HOME/xbmc/tools/depends/target/binary-addons/arm-linux-androideabi-21- release
make package-pvr.teleboy

it creates a zip file pvr.addonname-0.1.1-Android.zip under ./pvr.addonname-prefix/src/pvr.addonname-build having this structure:

.
├── lib
│   └── kodi
│       └── addons
│           └── pvr.teleboy
│               └── libpvr.addonname.so
└── share
    └── kodi
        └── addons
            └── pvr.addonname
                ├── addon.xml
                ├── fanart.jpg
                ├── icon.png
                ├── LICENSE.txt
                └── resources
                    ├── eit_categories.txt
                    ├── language
                    │   └── resource.language.en_gb
                    │       └── strings.po
                    └── settings.xml

As it is, it could not be installed on my Android TV so I have modified it manually as follows (coping the libpvr.addon.so library inside)

pvr.addonname
 ├── addon.xml
 ├── fanart.jpg
 ├── icon.png
 ├── libpvr.addonname.so
 ├── LICENSE.txt
 └── resources
    ├── eit_categories.txt
    ├── language
    │   └── resource.language.en_gb
    │       └── strings.po
    └── settings.xml

and compress it. That worked on Android Oreo but is there a better way to create a package with the right structure from start?

Second issue is to build the same package for Android Nougat (Api 24). I have installed the sdk platform android-24, build-tools 24.0.2 and modified again the configure script to avoid this:

build_tools_path=$use_sdk_path/tools:$use_sdk_path/platform-tools:$use_sdk_path/build-tools/`ls $use_sdk_path/build-tools | sort $SORT_PARAMS | tail -n 1`

I have defined a new arg --with-sdk-api to be able to switch to the sdk 24.0.2 on the same checkout otherwise the Makefile.include was always pointing to 26.0.2.

I have recompiled the binary addon and create the package as done before. The structure that is working for Oreo fails for Nougat. When I try to install the zip file on my phone, installation fails due to invalid structure.

Can anyone help me, please? What am I doing wrong? Please consider that yesterday was the first time that I compiled something for Kodi and Android.

Thank you in advance for your help!
Reply
#2
OK I have figured out why the installation was failing on the smartphone. The architecture was not the right one (armv8a and not armv7a). The error message "failed due to the invalid structure" is misleading, I think Kodi should be able to distinguish a package with a wrong structure from a wrong library compilation.

Btw, I would still like to understand why 'make package-pvr.teleboy' for android does not create the right package (.zip file) that can directly be installed in Kodi. Not even the version number is correct (pvr.addonname-0.1.1-Android.zip).

When I compile the binary addon for linux the command works well providing a package with the right structure and the correct version number.
Reply

Logout Mark Read Team Forum Stats Members Help
Build binary addon package for Android with the right structure0