diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index e73611f3..5f5f0a87 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -16,7 +16,7 @@ jobs: matrix: BUILD_TYPE: [Release] qt_arch: [android_arm64_v8a, android_x86_64] - qt_version: [6.6.2] + qt_version: [6.8.1] include: - qt_arch: android_arm64_v8a VCPKG_TARGET_TRIPLET: arm-android @@ -32,15 +32,15 @@ jobs: env: artifact_name: build_android - STOREPASS: ${{secrets.STOREPASS}} + STOREPASS: ${{secrets.STOREPASS}} SOURCE_DIR: ${{github.workspace}}/.cache/source TOOSL_DIR: ${{github.workspace}}/.cache/tools INSTALL_DIR: ${{github.workspace}}/.cache/install RabbitCommon_VERSION: v2.2.6 VCPKGGITCOMMITID: 59aeb8fe8fe1c980de6bd5ba634cf21024522d81 ANDROID_ABI: ${{matrix.ANDROID_ABI}} - ANDROID_PLATFORM: android-28 - ANDROID_NATIVE_API_LEVEL: 28 + ANDROID_PLATFORM: android-35 + ANDROID_NATIVE_API_LEVEL: 35 qt_modules: 'qtscxml' # Map the job outputs to step outputs @@ -74,9 +74,9 @@ jobs: with: dir: '${{env.TOOSL_DIR}}' # optional version: '${{matrix.qt_version}}' - #host: 'linux' + host: 'linux' target: 'desktop' - arch: 'gcc_64' + arch: 'linux_gcc_64' set-env: false cache: true cache-key-prefix: cached_qt @@ -131,13 +131,19 @@ jobs: -DQT_HOST_PATH=${Qt6_DIR}/../gcc_64 \ -DQt6LinguistTools_DIR=${Qt6_DIR}/../gcc_64/lib/cmake/Qt6LinguistTools \ -DCMAKE_INSTALL_PREFIX=`pwd`/install \ + -DANDROID_PLATFORM=${{env.ANDROID_PLATFORM}} \ -DBUILD_TEST=OFF \ -DBUILD_APP=OFF cmake --build . --config ${{matrix.BUILD_TYPE}} --target all + echo "cmake --build . --config ${{matrix.BUILD_TYPE}} --target install" cmake --build . --config ${{matrix.BUILD_TYPE}} --target install 7z a RabbitCommon_${{env.RabbitCommon_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.zip ./install/* - APK_FILE=`find . -name "android-*.apk"` - cp $APK_FILE RabbitCommon_${{env.RabbitCommon_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.apk + cd ${{github.workspace}}/build/FileBrowser + APK_FILE=`find . -name "android-*.apk" + cp $APK_FILE ${{github.workspace}}/build/FileBrowser_${{env.RabbitCommon_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.apk + cd ${{github.workspace}}/build/MimeTypeBrowser + APK_FILE=`find . -name "android-*.apk" + cp $APK_FILE ${{github.workspace}}/build/MimeTypeBrowser_${{env.RabbitCommon_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.apk - name: Update artifact if: ${{ matrix.BUILD_TYPE == 'Release' }} @@ -146,4 +152,4 @@ jobs: name: ${{ env.artifact_name }}_${{matrix.qt_version}}_${{matrix.qt_arch}} path: | ${{github.workspace}}/build/RabbitCommon_${{env.RabbitCommon_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.zip - ${{github.workspace}}/build/RabbitCommon_${{env.RabbitCommon_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.apk + ${{github.workspace}}/build/*.apk diff --git a/FileBrowser/android/AndroidManifest.xml b/FileBrowser/android/AndroidManifest.xml index 52255602..e89ee60f 100644 --- a/FileBrowser/android/AndroidManifest.xml +++ b/FileBrowser/android/AndroidManifest.xml @@ -4,10 +4,9 @@ android:installLocation="auto" android:versionCode="0" android:versionName="2.2.6"> - - - - + + + diff --git a/FileBrowser/android/build.gradle.bak b/FileBrowser/android/build.gradle.bak new file mode 100644 index 00000000..752a96eb --- /dev/null +++ b/FileBrowser/android/build.gradle.bak @@ -0,0 +1,83 @@ +buildscript { + repositories { + google() + mavenCentral() + } + + dependencies { + // https://developer.android.google.cn/build/releases/gradle-plugin?hl=zh-cn + classpath 'com.android.tools.build:gradle:8.2.2' + } +} + +repositories { + google() + mavenCentral() +} + +apply plugin: 'com.android.application' + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) + implementation 'androidx.core:core:1.10.1' +} + +android { + /******************************************************* + * The following variables: + * - androidBuildToolsVersion, + * - androidCompileSdkVersion + * - qtAndroidDir - holds the path to qt android files + * needed to build any Qt application + * on Android. + * + * are defined in gradle.properties file. This file is + * updated by QtCreator and androiddeployqt tools. + * Changing them manually might break the compilation! + *******************************************************/ + + compileSdkVersion androidCompileSdkVersion + buildToolsVersion androidBuildToolsVersion + ndkVersion androidNdkVersion + + // Extract native libraries from the APK + packagingOptions.jniLibs.useLegacyPackaging true + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = [qtAndroidDir + '/src', 'src', 'java'] + aidl.srcDirs = [qtAndroidDir + '/src', 'src', 'aidl'] + res.srcDirs = [qtAndroidDir + '/res', 'res'] + resources.srcDirs = ['resources'] + renderscript.srcDirs = ['src'] + assets.srcDirs = ['assets'] + jniLibs.srcDirs = ['libs'] + } + } + + tasks.withType(JavaCompile) { + options.incremental = true + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + lintOptions { + abortOnError false + } + + // Do not compress Qt binary resources file + aaptOptions { + noCompress 'rcc' + } + + defaultConfig { + resConfig "en" + minSdkVersion qtMinSdkVersion + targetSdkVersion qtTargetSdkVersion + ndk.abiFilters = qtTargetAbiList.split(",") + } +} diff --git a/MimeTypeBrowser/android/AndroidManifest.xml b/MimeTypeBrowser/android/AndroidManifest.xml new file mode 100644 index 00000000..2fd918cc --- /dev/null +++ b/MimeTypeBrowser/android/AndroidManifest.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MimeTypeBrowser/android/build.gradle.bak b/MimeTypeBrowser/android/build.gradle.bak new file mode 100644 index 00000000..752a96eb --- /dev/null +++ b/MimeTypeBrowser/android/build.gradle.bak @@ -0,0 +1,83 @@ +buildscript { + repositories { + google() + mavenCentral() + } + + dependencies { + // https://developer.android.google.cn/build/releases/gradle-plugin?hl=zh-cn + classpath 'com.android.tools.build:gradle:8.2.2' + } +} + +repositories { + google() + mavenCentral() +} + +apply plugin: 'com.android.application' + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) + implementation 'androidx.core:core:1.10.1' +} + +android { + /******************************************************* + * The following variables: + * - androidBuildToolsVersion, + * - androidCompileSdkVersion + * - qtAndroidDir - holds the path to qt android files + * needed to build any Qt application + * on Android. + * + * are defined in gradle.properties file. This file is + * updated by QtCreator and androiddeployqt tools. + * Changing them manually might break the compilation! + *******************************************************/ + + compileSdkVersion androidCompileSdkVersion + buildToolsVersion androidBuildToolsVersion + ndkVersion androidNdkVersion + + // Extract native libraries from the APK + packagingOptions.jniLibs.useLegacyPackaging true + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = [qtAndroidDir + '/src', 'src', 'java'] + aidl.srcDirs = [qtAndroidDir + '/src', 'src', 'aidl'] + res.srcDirs = [qtAndroidDir + '/res', 'res'] + resources.srcDirs = ['resources'] + renderscript.srcDirs = ['src'] + assets.srcDirs = ['assets'] + jniLibs.srcDirs = ['libs'] + } + } + + tasks.withType(JavaCompile) { + options.incremental = true + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + lintOptions { + abortOnError false + } + + // Do not compress Qt binary resources file + aaptOptions { + noCompress 'rcc' + } + + defaultConfig { + resConfig "en" + minSdkVersion qtMinSdkVersion + targetSdkVersion qtTargetSdkVersion + ndk.abiFilters = qtTargetAbiList.split(",") + } +} diff --git a/MimeTypeBrowser/android/res/drawable-hdpi/icon.png b/MimeTypeBrowser/android/res/drawable-hdpi/icon.png new file mode 100644 index 00000000..1a79c02a Binary files /dev/null and b/MimeTypeBrowser/android/res/drawable-hdpi/icon.png differ diff --git a/MimeTypeBrowser/android/res/drawable-ldpi/icon.png b/MimeTypeBrowser/android/res/drawable-ldpi/icon.png new file mode 100644 index 00000000..8440c10a Binary files /dev/null and b/MimeTypeBrowser/android/res/drawable-ldpi/icon.png differ diff --git a/MimeTypeBrowser/android/res/drawable-mdpi/icon.png b/MimeTypeBrowser/android/res/drawable-mdpi/icon.png new file mode 100644 index 00000000..d0fc25ef Binary files /dev/null and b/MimeTypeBrowser/android/res/drawable-mdpi/icon.png differ diff --git a/MimeTypeBrowser/android/res/drawable-xhdpi/icon.png b/MimeTypeBrowser/android/res/drawable-xhdpi/icon.png new file mode 100644 index 00000000..f7ce5904 Binary files /dev/null and b/MimeTypeBrowser/android/res/drawable-xhdpi/icon.png differ diff --git a/MimeTypeBrowser/android/res/drawable-xxhdpi/icon.png b/MimeTypeBrowser/android/res/drawable-xxhdpi/icon.png new file mode 100644 index 00000000..35cefbcb Binary files /dev/null and b/MimeTypeBrowser/android/res/drawable-xxhdpi/icon.png differ diff --git a/MimeTypeBrowser/android/res/drawable-xxxhdpi/icon.png b/MimeTypeBrowser/android/res/drawable-xxxhdpi/icon.png new file mode 100644 index 00000000..183835b2 Binary files /dev/null and b/MimeTypeBrowser/android/res/drawable-xxxhdpi/icon.png differ diff --git a/MimeTypeBrowser/android/res/values-zh-rCN/strings.xml b/MimeTypeBrowser/android/res/values-zh-rCN/strings.xml new file mode 100644 index 00000000..0716b9be --- /dev/null +++ b/MimeTypeBrowser/android/res/values-zh-rCN/strings.xml @@ -0,0 +1,6 @@ + + + + Mime类型浏览器 + + diff --git a/MimeTypeBrowser/android/res/values/strings.xml b/MimeTypeBrowser/android/res/values/strings.xml new file mode 100644 index 00000000..cae23fb9 --- /dev/null +++ b/MimeTypeBrowser/android/res/values/strings.xml @@ -0,0 +1,6 @@ + + + + Mime Type Browser + + diff --git a/build_android.sh b/build_android.sh new file mode 100755 index 00000000..43bd58f8 --- /dev/null +++ b/build_android.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +if [ -n $1 ]; then + Qt6_ROOT=$1 +fi + +mkdir -p build_android +cd build_android +${Qt6_ROOT}/bin/qt-cmake .. \ + -DCMAKE_BUILD_TYPE=Release \ + -DQT_HOST_PATH=${Qt6_ROOT}/../gcc_64 \ + -DQt6LinguistTools_DIR=${Qt6_ROOT}/../gcc_64/lib/cmake/Qt6LinguistTools \ + -DCMAKE_INSTALL_PREFIX=`pwd`/install \ + -DANDROID_PLATFORM=android-35 \ + -DBUILD_TEST=OFF \ + -DBUILD_APP=OFF + +cmake --build . -j $(nproc) diff --git a/deploy.sh b/deploy.sh index 2e7d7d8f..719895aa 100755 --- a/deploy.sh +++ b/deploy.sh @@ -70,6 +70,7 @@ sed -i "s/rabbitcommon (.*)/rabbitcommon (${DEBIAN_VERSION})/g" ${SOURCE_DIR}/de sed -i "s/Version=.*/Version=${DEBIAN_VERSION}/g" ${SOURCE_DIR}/share/org.Rabbit.RabbitCommon.desktop sed -i "s/[0-9]\+\.[0-9]\+\.[0-9]\+/${DEBIAN_VERSION}/g" ${SOURCE_DIR}/README*.md sed -i "s/versionName=\"[0-9]\+\.[0-9]\+\.[0-9]\+\"/versionName=\"${DEBIAN_VERSION}\"/g" ${SOURCE_DIR}/FileBrowser/android/AndroidManifest.xml +sed -i "s/versionName=\"[0-9]\+\.[0-9]\+\.[0-9]\+\"/versionName=\"${DEBIAN_VERSION}\"/g" ${SOURCE_DIR}/MimeTypeBrowser/android/AndroidManifest.xml sed -i "s/RabbitCommon_VERSION:.*/RabbitCommon_VERSION: ${DEBIAN_VERSION}/g" ${SOURCE_DIR}/.github/workflows/ubuntu.yml sed -i "s/RabbitCommon_VERSION:.*/RabbitCommon_VERSION: ${DEBIAN_VERSION}/g" ${SOURCE_DIR}/.github/workflows/qmake.yml if [ -f ${SOURCE_DIR}/vcpkg.json ]; then