Bläddra i källkod

Examples: Fix Android example build for Gradle 8. (#6229)

duddel 2 år sedan
förälder
incheckning
57d0fcd021

+ 1 - 1
.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

+ 1 - 0
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]
 
 
 -----------------------------------------------------------------------

+ 17 - 5
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'
         }
     }
 }

+ 3 - 3
examples/example_android_opengl3/android/app/src/main/AndroidManifest.xml

@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="imgui.example.android">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">
 
     <application
         android:label="ImGuiExample"
@@ -11,7 +10,8 @@
         <activity
             android:name="imgui.example.android.MainActivity"
             android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
-            android:configChanges="orientation|keyboardHidden|screenSize">
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            android:exported="false">
             <meta-data android:name="android.app.lib_name"
                 android:value="ImGuiExample" />
 

+ 2 - 2
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"
 
     }