From 09d7aa2353a7c250bcc6c445f8e77bac533901c3 Mon Sep 17 00:00:00 2001 From: wang-bin Date: Tue, 16 Jul 2024 14:50:18 +0800 Subject: [PATCH] android: sdk 34, api level 21 --- android/build.gradle | 20 +++++++------ example/android/app/build.gradle | 27 ++++++++++------- .../android/app/src/main/AndroidManifest.xml | 2 +- example/android/build.gradle | 20 ++----------- .../gradle/wrapper/gradle-wrapper.properties | 4 ++- example/android/settings.gradle | 30 ++++++++++++++----- 6 files changed, 57 insertions(+), 46 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index b15fc63..c1170f8 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:8.0.2' + classpath 'com.android.tools.build:gradle:8.5.0' // for compileSdk 34. default ndk 26.1.10909125 } } @@ -22,14 +22,18 @@ rootProject.allprojects { apply plugin: 'com.android.library' android { - namespace 'com.mediadevkit.fvp' - compileSdk 33 // flutter.compileSdkVersion + if (project.android.hasProperty("namespace")) { + namespace 'com.mediadevkit.fvp' + } // Bumping the plugin compileSdkVersion requires all clients of this plugin // to bump the version in their app. + compileSdk 34 - // Bumping the plugin ndkVersion requires all clients of this plugin to bump - // the version in their app and to download a newer version of the NDK. - //ndkVersion "25.2.9519653" // flutter.ndkVersion + // Use the NDK version + // declared in /android/app/build.gradle file of the Flutter project. + // Replace it with a version number if this plugin requires a specfic NDK version. + // (e.g. ndkVersion "23.1.7779620") + //ndkVersion '26.3.11579264' // android.ndkVersion // Invoke the shared CMake build with the Android Gradle Plugin. externalNativeBuild { @@ -42,7 +46,6 @@ android { // installed. You should not increase this version, as doing so will cause // the plugin to fail to compile for some customers of the plugin. // version "3.10.2" - //version "3.26.4" } } @@ -52,8 +55,7 @@ android { } defaultConfig { - minSdkVersion 16 - //targetSdkVersion 33 + minSdkVersion 21 // lower version error in ndk 26 externalNativeBuild { cmake { diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 9e5c687..81af107 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -21,20 +22,24 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { namespace "com.mediadevkit.fvp_example" compileSdk flutter.compileSdkVersion - ndkVersion flutter.ndkVersion + //ndkVersion flutter.ndkVersion // too low version compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + kotlinOptions { + jvmTarget = '1.8' + } + + sourceSets { + //main.java.srcDirs += 'src/main/kotlin' + } + defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.mediadevkit.fvp_example" @@ -58,3 +63,5 @@ android { flutter { source '../..' } + +dependencies {} \ No newline at end of file diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 2193863..2197491 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -38,7 +38,7 @@ android:value="2" /> + android:value="false" />