From 57d0fcd0210dd0d337d0c34e4bf25b4c1eada254 Mon Sep 17 00:00:00 2001 From: duddel Date: Tue, 7 Mar 2023 07:17:56 +0100 Subject: [PATCH] Examples: Fix Android example build for Gradle 8. (#6229) --- .github/workflows/build.yml | 2 +- docs/CHANGELOG.txt | 1 + .../android/app/build.gradle | 22 ++++++++++++++----- .../android/app/src/main/AndroidManifest.xml | 6 ++--- .../android/build.gradle | 4 ++-- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 17aabecb..45688c47 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -504,4 +504,4 @@ jobs: - name: Build example_android_opengl3 run: | cd examples/example_android_opengl3/android - gradle assembleDebug + gradle assembleDebug --stacktrace diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index efed7a3c..2ad355e2 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -57,6 +57,7 @@ Other changes: non-client area (e.g. OS decorations) when app is not focused. (#6045, #6162) - Backends: SDL2, SDL3: Accept SDL_GetPerformanceCounter() not returning a monotonically increasing value. (#6189, #6114, #3644) [@adamkewley] +- Examples: Android: Fixed example build for Gradle 8. (#6229, #6227) [@duddel] ----------------------------------------------------------------------- diff --git a/examples/example_android_opengl3/android/app/build.gradle b/examples/example_android_opengl3/android/app/build.gradle index aa7f0ead..53181baa 100644 --- a/examples/example_android_opengl3/android/app/build.gradle +++ b/examples/example_android_opengl3/android/app/build.gradle @@ -2,13 +2,15 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' android { - compileSdkVersion 29 - buildToolsVersion "30.0.3" - ndkVersion "21.4.7075529" + compileSdkVersion 33 + buildToolsVersion "33.0.2" + ndkVersion "25.2.9519653" + defaultConfig { applicationId "imgui.example.android" - minSdkVersion 23 - targetSdkVersion 29 + namespace "imgui.example.android" + minSdkVersion 24 + targetSdkVersion 33 versionCode 1 versionName "1.0" } @@ -20,9 +22,19 @@ android { } } + compileOptions { + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } + + kotlinOptions { + jvmTarget="11" + } + externalNativeBuild { cmake { path "../../CMakeLists.txt" + version '3.22.1' } } } diff --git a/examples/example_android_opengl3/android/app/src/main/AndroidManifest.xml b/examples/example_android_opengl3/android/app/src/main/AndroidManifest.xml index c4009e52..a87b95b4 100644 --- a/examples/example_android_opengl3/android/app/src/main/AndroidManifest.xml +++ b/examples/example_android_opengl3/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ - + + android:configChanges="orientation|keyboardHidden|screenSize" + android:exported="false"> diff --git a/examples/example_android_opengl3/android/build.gradle b/examples/example_android_opengl3/android/build.gradle index 59f9c78e..ccd21852 100644 --- a/examples/example_android_opengl3/android/build.gradle +++ b/examples/example_android_opengl3/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.4.31' + ext.kotlin_version = '1.8.0' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.0' + classpath 'com.android.tools.build:gradle:7.4.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" }