Skip to content

Commit

Permalink
Update Android Source Package (#11233)
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey authored Apr 13, 2024
1 parent f27a796 commit de2bac7
Show file tree
Hide file tree
Showing 21 changed files with 512 additions and 112 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
java-version: 17

- uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,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 "${CMAKE_PROJECT_VERSION}"
# QT_ANDROID_VERSION_CODE "${CMAKE_PROJECT_VERSION}"
Expand Down
74 changes: 52 additions & 22 deletions android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,55 +1,96 @@
<?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%% --">

<!-- %%INSERT_PERMISSIONS -->
<!-- %%INSERT_FEATURES -->

<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true" />

<!-- %%INSERT_PERMISSIONS -->

<!-- Needed to keep working while 'asleep' -->
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<!-- Need MulticastLock to receive broadcast UDP packets -->
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>

<!-- %%INSERT_FEATURES -->

<uses-feature android:name="android.hardware.usb.host" android:required="false"/>
<uses-feature android:name="android.hardware.usb.accessory" android:required="false"/>
<uses-feature android:name="android.hardware.bluetooth" android:required="false"/>
<uses-feature android:name="android.hardware.location.gps" android:required="false"/>
<uses-feature android:name="android.hardware.location.network" android:required="false"/>
<uses-feature android:name="android.hardware.location" android:required="false"/>

<application
android:name="org.qtproject.qt.android.bindings.QtApplication"
android:hardwareAccelerated="true"
android:label="-- %%INSERT_APP_NAME%% --"
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">
<!-- android:theme="@style/AppTheme" -->

<!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/" /> -->

<activity
android:name="org.mavlink.qgroundcontrol.QGCActivity"
android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
android:label="-- %%INSERT_APP_NAME%% --"
android:launchMode="singleTop"
android:screenOrientation="sensorLandscape"
android:exported="true">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />

<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
<action android:name="android.hardware.usb.action.USB_DEVICE_DETACHED" />
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
<action android:name="android.bluetooth.device.action.ACL_CONNECTED" />
<action android:name="android.bluetooth.device.action.ACL_DISCONNECTED" />
<!-- TODO: CMake configure xml file -->
<!-- %%QGC_INSERT_ACTIVITY_INTENT_FILTER -->
</intent-filter>

<!-- %%QGC_INSERT_ACTIVITY_META_DATA -->
<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />
<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_DETACHED"
android:resource="@xml/device_filter" />
<meta-data
android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="@xml/device_filter" />

<meta-data
android:name="android.app.lib_name"
android:value="-- %%INSERT_APP_LIB_NAME%% --" />

<meta-data
android:name="android.app.arguments"
android:value="-- %%INSERT_APP_ARGUMENTS%% --" />

<meta-data
android:name="android.app.extract_android_style"
android:value="minimal" />
<meta-data
android:name="android.app.splash_screen_drawable"
android:resource="@drawable/splashscreen" />
<!-- <meta-data android:name="android.app.splash_screen_drawable_portrait" -->
<!-- <meta-data android:name="android.app.splash_screen_drawable_landscape" -->
<meta-data
android:name="android.app.splash_screen_sticky"
android:value="false" />
<!-- <meta-data android:name="android.app.background_running" -->
<!-- <meta-data android:name="android.app.trace_location" -->
</activity>

<provider
Expand All @@ -59,20 +100,9 @@
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/qtprovider_paths"/>
android:resource="@xml/qtprovider_paths" />
</provider>
</application>

<!-- Needed to keep working while 'asleep' -->
<uses-permission android:name="android.permission.WAKE_LOCK"/>

<!-- Need MulticastLock to receive broadcast UDP packets -->
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
</application>

<uses-feature android:name="android.hardware.usb.host" android:required="false"/>
<uses-feature android:name="android.hardware.usb.accessory" android:required="false"/>
<uses-feature android:name="android.hardware.bluetooth" android:required="false"/>
<uses-feature android:name="android.hardware.location.gps" android:required="false"/>
<uses-feature android:name="android.hardware.location.network" android:required="false"/>
<uses-feature android:name="android.hardware.location" android:required="false"/>
</manifest>
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.2'
}
}

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"
// versionName "5.0"
// versionCode 5

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}"
}
26 changes: 26 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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
#org.gradle.configuration-cache=true

# Allow AndroidX usage
android.useAndroidX=true

#androidCompileSdkVersion=34
#androidBuildToolsVersion=34.0.0
#androidNdkVersion=26.1.10909125

#qtMinSdkVersion=23
#qtTargetSdkVersion=34
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.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit de2bac7

Please sign in to comment.