Skip to content

Commit

Permalink
Update Android Package
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Mar 15, 2024
1 parent 37315ab commit 072f5e0
Show file tree
Hide file tree
Showing 22 changed files with 642 additions and 254 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/android_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ jobs:

- run: sudo apt update

- name: Setup Java environment
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
Expand Down Expand Up @@ -103,10 +109,6 @@ jobs:
mkdir gstreamer-1.0-android-universal-1.18.5
tar xf gstreamer-1.0-android-universal-1.18.5.tar.xz -C gstreamer-1.0-android-universal-1.18.5
- name: Update android manifest
if: github.ref_name != 'Stable'
run: ${SOURCE_DIR}/tools/update_android_manifest_package.sh ${{ github.ref_name }}

- name: Install dependencies
run: sudo apt-get install -y ninja-build

Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/android_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ jobs:

- run: sudo apt update

- name: Setup Java environment
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
Expand Down Expand Up @@ -96,11 +102,6 @@ jobs:
mkdir gstreamer-1.0-android-universal-1.18.5
tar xf gstreamer-1.0-android-universal-1.18.5.tar.xz -C gstreamer-1.0-android-universal-1.18.5
- name: Update android manifest
if: github.ref_name != 'Stable'
run: |
${SOURCE_DIR}/tools/update_android_manifest_package.sh ${{ github.ref_name }}
- name: Build
working-directory: ${{ runner.temp }}/shadow_build_dir
env:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ elseif(ANDROID)
PROPERTIES
QT_ANDROID_ABIS ${ANDROID_ABI}
QT_ANDROID_MIN_SDK_VERSION 26
QT_ANDROID_TARGET_SDK_VERSION 33
QT_ANDROID_TARGET_SDK_VERSION 34
QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/android
QT_ANDROID_VERSION_NAME ${APP_VERSION_STR}
# QT_ANDROID_VERSION_CODE 5.0
Expand Down
2 changes: 1 addition & 1 deletion QGCCommon.pri
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ AndroidBuild {

message(Android version info: $${ANDROID_VERSION_CODE} bitness:$${ANDROID_VERSION_BITNESS} major:$${MAJOR_VERSION} minor:$${MINOR_VERSION} patch:$${PATCH_VERSION} dev:$${DEV_VERSION})

ANDROID_VERSION_NAME = APP_VERSION_STR
ANDROID_VERSION_NAME = $${APP_VERSION_STR}

QMAKE_LFLAGS += -Wl,-Bsymbolic
}
Expand Down
63 changes: 32 additions & 31 deletions android.pri
Original file line number Diff line number Diff line change
Expand Up @@ -74,44 +74,45 @@ contains(DEFINES, NO_SERIAL_LINK) {

# OTHER_FILES makes the specified files be visible in Qt Creator for editing

exists($$PWD/custom/android/AndroidManifest.xml) {
OTHER_FILES += \
$$PWD/custom/android/AndroidManifest.xml
exists($$ANDROID_PACKAGE_CUSTOM_SOURCE_DIR/AndroidManifest.xml) {
DISTFILES += \
$$ANDROID_PACKAGE_CUSTOM_SOURCE_DIR/AndroidManifest.xml
} else {
OTHER_FILES += \
$$PWD/android/AndroidManifest.xml
DISTFILES += \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/AndroidManifest.xml
}

OTHER_FILES += \
$$PWD/android/res/xml/device_filter.xml \
$$PWD/android/src/com/hoho/android/usbserial/driver/CdcAcmSerialDriver.java \
$$PWD/android/src/com/hoho/android/usbserial/driver/CommonUsbSerialDriver.java \
$$PWD/android/src/com/hoho/android/usbserial/driver/Cp2102SerialDriver.java \
$$PWD/android/src/com/hoho/android/usbserial/driver/FtdiSerialDriver.java \
$$PWD/android/src/com/hoho/android/usbserial/driver/ProlificSerialDriver.java \
$$PWD/android/src/com/hoho/android/usbserial/driver/UsbId.java \
$$PWD/android/src/com/hoho/android/usbserial/driver/UsbSerialDriver.java \
$$PWD/android/src/com/hoho/android/usbserial/driver/UsbSerialProber.java \
$$PWD/android/src/com/hoho/android/usbserial/driver/UsbSerialRuntimeException.java \
$$PWD/android/src/org/mavlink/qgroundcontrol/QGCActivity.java \
$$PWD/android/src/org/mavlink/qgroundcontrol/UsbIoManager.java \
$$PWD/android/src/org/freedesktop/gstreamer/androidmedia/GstAhcCallback.java \
$$PWD/android/src/org/freedesktop/gstreamer/androidmedia/GstAhsCallback.java \
$$PWD/android/src/org/freedesktop/gstreamer/androidmedia/GstAmcOnFrameAvailableListener.java

DISTFILES += \
$$PWD/android/gradle/wrapper/gradle-wrapper.jar \
$$PWD/android/gradlew \
$$PWD/android/res/values/libs.xml \
$$PWD/android/build.gradle \
$$PWD/android/gradle/wrapper/gradle-wrapper.properties \
$$PWD/android/gradlew.bat
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/build.gradle \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/gradle/wrapper/gradle-wrapper.jar \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/gradle/wrapper/gradle-wrapper.properties \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/gradlew \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/gradlew.bat \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/res/values/libs.xml \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/res/xml/device_filter.xml \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/res/xml/network_security_config.xml \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/res/xml/qtprovider_paths.xml \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src/com/hoho/android/usbserial/driver/CdcAcmSerialDriver.java \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src/com/hoho/android/usbserial/driver/CommonUsbSerialDriver.java \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src/com/hoho/android/usbserial/driver/Cp2102SerialDriver.java \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src/com/hoho/android/usbserial/driver/FtdiSerialDriver.java \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src/com/hoho/android/usbserial/driver/ProlificSerialDriver.java \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src/com/hoho/android/usbserial/driver/UsbId.java \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src/com/hoho/android/usbserial/driver/UsbSerialDriver.java \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src/com/hoho/android/usbserial/driver/UsbSerialProber.java \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src/com/hoho/android/usbserial/driver/UsbSerialRuntimeException.java \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src/org/freedesktop/gstreamer/androidmedia/GstAhcCallback.java \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src/org/freedesktop/gstreamer/androidmedia/GstAhsCallback.java \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src/org/freedesktop/gstreamer/androidmedia/GstAmcOnFrameAvailableListener.java \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src/org/mavlink/qgroundcontrol/QGCActivity.java \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src/org/mavlink/qgroundcontrol/UsbIoManager.java

SOURCES += \
$$PWD/android/src/AndroidInterface.cc
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src/AndroidInit.cpp \
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src/AndroidInterface.cc

HEADERS += \
$$PWD/android/src/AndroidInterface.h
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src/AndroidInterface.h

INCLUDEPATH += \
$$PWD/android/src
$$ANDROID_PACKAGE_QGC_SOURCE_DIR/src
12 changes: 9 additions & 3 deletions android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.qtproject.example"
package="org.mavlink.qgroundcontrol"
android:installLocation="auto"

android:versionCode="-- %%INSERT_VERSION_CODE%% --"
android:versionName="-- %%INSERT_VERSION_NAME%% --">

Expand All @@ -22,7 +22,9 @@
android:requestLegacyExternalStorage="true"
android:allowBackup="true"
android:fullBackupOnly="false"
android:icon="@drawable/icon">
android:icon="@drawable/icon"
android:usesCleartextTraffic="true"
android:networkSecurityConfig="@xml/network_security_config">
<activity
android:name="org.mavlink.qgroundcontrol.QGCActivity"
android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
Expand Down Expand Up @@ -50,6 +52,10 @@
<meta-data
android:name="android.app.extract_android_style"
android:value="minimal" />

<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />
</activity>

<provider
Expand Down
26 changes: 21 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.4.1'
classpath 'com.android.tools.build:gradle:8.3.0'
}
}

Expand All @@ -18,7 +18,7 @@ apply plugin: 'com.android.application'

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.core:core:1.10.1'
implementation 'androidx.core:core:1.12.0'
}

android {
Expand Down Expand Up @@ -60,8 +60,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

lintOptions {
Expand All @@ -75,8 +75,24 @@ android {

defaultConfig {
resConfig "en"
minSdkVersion 25
minSdkVersion qtMinSdkVersion
targetSdkVersion qtTargetSdkVersion
ndk.abiFilters = qtTargetAbiList.split(",")

namespace "org.mavlink.qgroundcontrol"
// versionCode = 1.0
// versionName = "1.0"

println "minSdkVersion: ${minSdkVersion}"
println "targetSdkVersion: ${targetSdkVersion}"
println "ndk.abiFilters: ${ndk.abiFilters}"
println "versionCode: ${versionCode}"
println "versionName: ${versionName}"
}

println "androidCompileSdkVersion: ${compileSdkVersion}"
println "androidBuildToolsVersion: ${buildToolsVersion}"
println "androidNdkVersion: ${ndkVersion}"
println "project.name: ${project.name}"
println "qtAndroidDir: ${qtAndroidDir}"
}
17 changes: 17 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Project-wide Gradle settings.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2500m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# Enable building projects in parallel
org.gradle.parallel=true

# Gradle caching allows reusing the build artifacts from a previous
# build with the same inputs. However, over time, the cache size will
# grow. Uncomment the following line to enable it.
#org.gradle.caching=true

# Allow AndroidX usage
android.useAndroidX=true
Binary file added android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 072f5e0

Please sign in to comment.