Files
flutter/packages/flutter_tools/templates/plugin_ffi/android.tmpl/build.gradle.tmpl
stuartmorgan e8254b2024 Update Android plugin templates for newer AGP (#156533)
Now that Flutter requires AGP 7+, we can use Java 11 as the compatibility version in the plugin template rather than 1.8, avoiding warnings with newer toolchains, and we can remove the check for 'namespace' existing that was only necessary to support AGP 4.1.

See also https://github.com/flutter/packages/pull/7795 which made this change in Flutter-team-owned plugins.

Part of https://github.com/flutter/flutter/issues/156111
2024-10-10 17:18:50 +00:00

64 lines
1.8 KiB
Cheetah

// The Android Gradle Plugin builds the native code with the Android NDK.
group = "{{androidIdentifier}}"
version = "1.0"
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
// The Android Gradle Plugin knows how to build native code with the NDK.
classpath("com.android.tools.build:gradle:{{agpVersion}}")
}
}
rootProject.allprojects {
repositories {
google()
mavenCentral()
}
}
apply plugin: "com.android.library"
android {
namespace = "{{androidIdentifier}}"
// Bumping the plugin compileSdk version requires all clients of this plugin
// to bump the version in their app.
compileSdk = {{compileSdkVersion}}
// 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 specific NDK version.
// (e.g. ndkVersion "23.1.7779620")
ndkVersion = android.ndkVersion
// Invoke the shared CMake build with the Android Gradle Plugin.
externalNativeBuild {
cmake {
path = "../src/CMakeLists.txt"
// The default CMake version for the Android Gradle Plugin is 3.10.2.
// https://developer.android.com/studio/projects/install-ndk#vanilla_cmake
//
// The Flutter tooling requires that developers have CMake 3.10 or later
// 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"
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
defaultConfig {
minSdk = {{minSdkVersion}}
}
}