Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Build Android

permissions:
contents: read
pull-requests: write

on:
workflow_dispatch:
workflow_call:
Expand All @@ -14,14 +18,14 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
aqtversion: '==3.1.*'
version: '5.12.12'
aqtversion: '==3.3.*'
version: '5.14.2'
host: 'linux'
target: 'android'
arch: 'android_armv7'
arch: 'android'

- name: Install SDK
run: ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --install 'platforms;android-28' 'build-tools;28.0.3' 'ndk;21.3.6528147'
run: ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --install 'platforms;android-31' 'build-tools;31.0.0' 'ndk;21.3.6528147'

# Secrets should be the base64 portion of the PEM format
# (i.e. the stuff between the BEGIN/END lines):
Expand Down Expand Up @@ -60,20 +64,28 @@ jobs:
qmake -config release
make -j$(nproc)
make INSTALL_ROOT=android-build install
JAVA_HOME=${JAVA_HOME_8_X64} androiddeployqt --input android-libLabrador.so-deployment-settings.json --output android-build --android-platform android-28 --verbose --gradle --release
${ANDROID_SDK_ROOT}/build-tools/28.0.3/apksigner sign --in android-build/build/outputs/apk/release/android-build-release-unsigned.apk --out ${APK_BASENAME}-release-signed.apk --key cert.p8 --cert cert.cer --verbose
JAVA_HOME=${JAVA_HOME_8_X64} androiddeployqt --input android-Labrador-deployment-settings.json --output android-build --aab --android-platform android-31 --verbose --gradle --release
${ANDROID_SDK_ROOT}/build-tools/31.0.0/apksigner sign --in android-build/build/outputs/apk/release/android-build-release-unsigned.apk --out ${APK_BASENAME}-release-signed.apk --key cert.p8 --cert cert.cer --verbose
else
qmake -config debug
make -j$(nproc)
make INSTALL_ROOT=android-build install
JAVA_HOME=${JAVA_HOME_8_X64} androiddeployqt --input android-libLabrador.so-deployment-settings.json --output android-build --android-platform android-28 --verbose --gradle
JAVA_HOME=${JAVA_HOME_8_X64} androiddeployqt --input android-Labrador-deployment-settings.json --output android-build --aab --android-platform android-31 --verbose --gradle
cp android-build/build/outputs/apk/debug/android-build-debug.apk ${APK_BASENAME}-debug.apk
fi
cp android-build/build/outputs/bundle/release/android-build-release.aab ${APK_BASENAME}-release-unsigned.aab

- name: Upload artifacts
- name: Upload apk artifacts
uses: actions/upload-artifact@v4
with:
name: asset-apk
path: Desktop_Interface/Labrador*.apk
compression-level: 0
if-no-files-found: error
- name: Upload aab artifacts
uses: actions/upload-artifact@v4
with:
name: asset-aab
path: Desktop_Interface/Labrador*.aab
compression-level: 0
if-no-files-found: error
27 changes: 15 additions & 12 deletions Desktop_Interface/Labrador.pro
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ android {

QT += androidextras
CONFIG += mobility
CONFIG += android_app_bundle
MOBILITY =

DEFINES += PLATFORM_ANDROID
Expand All @@ -287,13 +288,13 @@ android {
INCLUDEPATH += build_android/libusb-242

ANDROID_PACKAGE_SOURCE_DIR = build_android/package_source
#ANDROID_MIN_SDK_VERSION = 21
#ANDROID_TARGET_SDK_VERSION = 28
ANDROID_SDK_BUILD_TOOLS_REVISION = 28.0.3
ANDROID_MIN_SDK_VERSION = 21
ANDROID_TARGET_SDK_VERSION = 31
ANDROID_SDK_BUILD_TOOLS_REVISION = 31.0.0

# These are used in the AndroidManifest.xml template
ANDROID_VERSION_NAME = 1.3
ANDROID_VERSION_CODE = 8
ANDROID_VERSION_NAME = 1.4
ANDROID_VERSION_CODE = 9
ANDROID_PERMISSIONS += android.permission.INTERNET
ANDROID_PERMISSIONS += android.permission.WRITE_EXTERNAL_STORAGE
ANDROID_PERMISSIONS += android.permission.READ_EXTERNAL_STORAGE
Expand All @@ -307,26 +308,28 @@ android {
INSTALLS += firmware waveforms

#libdfuprog include
LIBS += -L$$PWD/build_android/libdfuprog/lib -ldfuprog-0.9
INCLUDEPATH += build_android/libdfuprog/include
ANDROID_EXTRA_LIBS += $${PWD}/build_android/libdfuprog/lib/libdfuprog-0.9.so

#liblog include
LIBS += -L$$PWD/build_android/liblog/lib -llog
ANDROID_EXTRA_LIBS += $${PWD}/build_android/liblog/lib/liblog.so

# Frequency spectrum/response disabled for now, needs UI and supporting libraries
DEFINES += DISABLE_SPECTRUM
SOURCES -= asyncdft.cpp
HEADERS -= asyncdft.h

# Library dependencies are only compiled for this ABI currently
ANDROID_ABIS = armeabi-v7a
ANDROID_ABIS = armeabi-v7a arm64-v8a

# Doing the following inside one equals() failed. qmake bug? https://forum.qt.io/topic/113836/dynamic-libs-on-android-with-qt5-14-2/4
for(abi, ANDROID_ABIS): message("Building for Android ($${abi})")
for(abi, ANDROID_ABIS): LIBS += -L$${PWD}/build_android/libusb-242/android/$${abi} -lusb1.0
for(abi, ANDROID_ABIS): ANDROID_EXTRA_LIBS += $${PWD}/build_android/libusb-242/android/$${abi}/libusb1.0.so

#libdfuprog library
for(abi, ANDROID_ABIS): LIBS += -L$$PWD/build_android/libdfuprog/lib/$${abi} -ldfuprog-0.9
for(abi, ANDROID_ABIS): ANDROID_EXTRA_LIBS += $${PWD}/build_android/libdfuprog/lib/$${abi}/libdfuprog-0.9.so

#liblog library
for(abi, ANDROID_ABIS): LIBS += -L$$PWD/build_android/liblog/lib/$${abi} -llog
for(abi, ANDROID_ABIS): ANDROID_EXTRA_LIBS += $${PWD}/build_android/liblog/lib/$${abi}/liblog.so
}

DISTFILES += \
Expand Down
7 changes: 4 additions & 3 deletions Desktop_Interface/androidusbdriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ unsigned char androidUsbDriver::usbInit(unsigned long VIDin, unsigned long PIDin
return E_BOARD_IN_BOOTLOADER;
}

libusb_set_option(ctx, LIBUSB_OPTION_NO_DEVICE_DISCOVERY);
int error = libusb_init(&ctx);
if(error){
qDebug() << "libusb_init FAILED";
qDebug() << "libusb_init FAILED with error" << error;
return error;
} else qDebug() << "Libusb context initialised";

Expand All @@ -60,7 +61,7 @@ unsigned char androidUsbDriver::usbInit(unsigned long VIDin, unsigned long PIDin
qDebug() << "Opening Device!";
//libusb_device * device_ptr = libusb_get_device2(ctx, usbfs_path);
//error = libusb_open2(device_ptr, &handle, file_descriptor);
error = libusb_wrap_fd(ctx, file_descriptor, &handle);
error = libusb_wrap_sys_device(ctx, file_descriptor, &handle);
if(error){
qDebug() << "ERROR OPENING DEVICE";
return error;
Expand Down Expand Up @@ -121,7 +122,7 @@ int androidUsbDriver::get_new_bootloader_ctx(libusb_device **device_ptr, libusb_

//*(device_ptr) = libusb_get_device2(*(ctx), usbfs_path);
//error = libusb_open2(*(device_ptr), handle, file_descriptor);
error = libusb_wrap_fd(*(ctx), file_descriptor, handle);
error = libusb_wrap_sys_device(*(ctx), file_descriptor, handle);
if(error){
qDebug() << "ERROR OPENING DEVICE";
return error;
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Loading