Reverts "Force automatic ndk download when building for Android (#159756)" (#160205)

<!-- start_original_pr_link -->
Reverts: flutter/flutter#159756
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: gmackall
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: Made the tree red due to some std out.
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: gmackall
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {reidbaker}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
In preparation for changing engine builds to be unstripped by default
https://github.com/flutter/engine/pull/52852, which will allow us to
make progress towards resolving
https://github.com/flutter/flutter/issues/60240.

Tricks AGP in to downloading the NDK when building a flutter app (that
uses the FGP, which to my knowledge is all ways of building flutter
apk/aab/aar).

I want to follow this up by modifying the tool to search for the log
line that the NDK is missing (making it throw an error in that case) as
a safeguard, because that would be the last line of defense before we
accidentally build a bloated app. The safeguard won't work for add to
app, from what I understand, because while they use the FGP (so they
should be forced to be download the NDK) they don't invoke the flutter
tool, and therefore won't invoke the custom error handling of
[`gradle_errors.dart`](https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/android/gradle_errors.dart)

Some details

1. Respects existing values for `externalNativeBuild.cmake.path` for
apps that actually use it.
2. Silences some warnings that would otherwise appear for add to app
builds or builds that manually invoke gradle:
```
C/C++: CMake Warning (dev) in CMakeLists.txt:
C/C++:   No project() command is present.  The top-level CMakeLists.txt file must
C/C++:   contain a literal, direct call to the project() command.  Add a line of
C/C++:   code such as
C/C++:     project(ProjectName)
C/C++:   near the top of the file, but after cmake_minimum_required().
C/C++:   CMake is pretending there is a "project(Project)" command on the first
C/C++:   line.
C/C++: This warning is for project developers.  Use -Wno-dev to suppress it.
C/C++: CMake Warning:
C/C++:   Manually-specified variables were not used by the project:
C/C++:     CMAKE_EXPORT_COMPILE_COMMANDS
C/C++:     CMAKE_LIBRARY_OUTPUT_DIRECTORY
C/C++:     CMAKE_RUNTIME_OUTPUT_DIRECTORY
```
3. Our ci installs the NDK at an abnormal place that AGP can't find
without help. I've modified all the `build.gradle`s that we have checked
in to point to the pre-installed path. **But some of our tests make a
new app from the templates, and those tests will now start downloading
the NDK** (as they won't be able to find it at it's current path from
templates). We could resolve this by actually fixing
https://github.com/flutter/flutter/issues/136666. This would be a very
significant lift from what I understand - we rely on this hardcoding in
a lot of places in our infra.


Fixes https://github.com/flutter/flutter/issues/155576

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
This commit is contained in:
auto-submit[bot] 2024-12-12 23:44:26 +00:00 committed by GitHub
parent 99786b413f
commit 5cd440f6ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
42 changed files with 14 additions and 382 deletions

View File

@ -5503,7 +5503,7 @@ targets:
add_recipes_cq: "true"
dependencies: >-
[
{"dependency": "android_sdk", "version": "version:35v1"},
{"dependency": "android_sdk", "version": "version:33v6"},
{"dependency": "chrome_and_driver", "version": "version:125.0.6422.141"},
{"dependency": "open_jdk", "version": "version:17"},
{"dependency": "goldctl", "version": "git_revision:2387d6fff449587eecbb7e45b2692ca0710b63b9"},
@ -5521,7 +5521,7 @@ targets:
add_recipes_cq: "true"
dependencies: >-
[
{"dependency": "android_sdk", "version": "version:35v1"},
{"dependency": "android_sdk", "version": "version:33v6"},
{"dependency": "chrome_and_driver", "version": "version:125.0.6422.141"},
{"dependency": "open_jdk", "version": "version:17"},
{"dependency": "goldctl", "version": "git_revision:2387d6fff449587eecbb7e45b2692ca0710b63b9"},
@ -5539,7 +5539,7 @@ targets:
add_recipes_cq: "true"
dependencies: >-
[
{"dependency": "android_sdk", "version": "version:35v1"},
{"dependency": "android_sdk", "version": "version:33v6"},
{"dependency": "chrome_and_driver", "version": "version:125.0.6422.141"},
{"dependency": "open_jdk", "version": "version:17"},
{"dependency": "goldctl", "version": "git_revision:2387d6fff449587eecbb7e45b2692ca0710b63b9"},

View File

@ -35,15 +35,7 @@ if (keystorePropertiesFile.exists()) {
android {
namespace "com.example.a11y_assessments"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8

View File

@ -29,15 +29,6 @@ android {
namespace "com.yourcompany.complexLayout"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11

View File

@ -29,15 +29,6 @@ android {
namespace "com.example.macrobenchmarks"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -29,15 +29,6 @@ android {
namespace "com.yourcompany.microbenchmarks"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -16,15 +16,6 @@ android {
namespace "dev.flutter.multipleflutters"
compileSdk 34
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = "26.3.11579264" // This version must exactly match the version of the NDK that the recipe pulls from CIPD.
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -29,15 +29,6 @@ android {
namespace "dev.benchmarks.platform_views_layout"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -29,15 +29,6 @@ android {
namespace "dev.benchmarks.platform_views_layout_hybrid_composition"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -29,15 +29,6 @@ android {
namespace "io.flutter.examples.stocks"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -15,7 +15,7 @@ Future<void> main() async {
try {
await runProjectTest((FlutterProject flutterProject) async {
section('APK contains plugin classes');
await flutterProject.setMinSdkVersion(21);
await flutterProject.setMinSdkVersion(20);
await flutterProject.addPlugin('google_maps_flutter:^2.2.1');
await inDirectory(flutterProject.rootPath, () async {

View File

@ -20,15 +20,6 @@ android {
namespace = "com.yourcompany.platforminteraction"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -29,15 +29,7 @@ if (flutterVersionName == null) {
android {
namespace "io.flutter.integration.android_verified_input"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8

View File

@ -29,15 +29,6 @@ android {
namespace = 'io.flutter.integration.platformviews'
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -29,15 +29,7 @@ if (flutterVersionName == null) {
android {
namespace "com.example.channels"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8

View File

@ -36,15 +36,6 @@ android {
namespace "io.flutter.integration.deferred_components_test"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

View File

@ -26,15 +26,6 @@ android {
namespace "io.flutter.integration.deferred_components_test.component1"
compileSdk 35
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = "26.3.11579264" // This version must exactly match the version of the NDK that the recipe pulls from CIPD.
ndkPath = systemNdkPath
}
sourceSets {
applicationVariants.all { variant ->
main.assets.srcDirs += "${project.layout.buildDirectory.get()}/intermediates/flutter/${variant.name}/deferred_assets"

View File

@ -19,15 +19,6 @@ android {
namespace = "io.flutter.externalui"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -19,15 +19,6 @@ android {
namespace "com.yourcompany.flavors"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -45,15 +45,6 @@ android {
namespace "io.flutter.demo.gallery"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -22,15 +22,6 @@ android {
namespace = "com.yourcompany.flavors"
compileSdk 34
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -29,15 +29,6 @@ android {
namespace = "io.flutter.integration.platformviews"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -8,15 +8,6 @@ android {
namespace = "io.flutter.addtoapp"
compileSdk 34
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = "26.3.11579264" // This version must exactly match the version of the NDK that the recipe pulls from CIPD.
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -12,15 +12,7 @@ plugins {
android {
namespace = "com.example.native_driver_test"
compileSdk = flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
ndkVersion = flutter.ndkVersion
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8

View File

@ -30,15 +30,6 @@ android {
namespace = "com.example.non_nullable"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -19,15 +19,6 @@ android {
namespace = "com.yourcompany.platforminteraction"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -8,15 +8,6 @@ android {
namespace = "io.flutter.add2app"
compileSdk 34
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = "26.3.11579264" // This version must exactly match the version of the NDK that the recipe pulls from CIPD.
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -8,15 +8,6 @@ android {
namespace = "io.flutter.add2app"
compileSdk 34
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = "26.3.11579264" // This version must exactly match the version of the NDK that the recipe pulls from CIPD.
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -7,15 +7,6 @@ android {
namespace = "com.example.myapplication"
compileSdk = 34
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
val systemNdkPath: String? = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = "26.3.11579264" // This version must exactly match the version of the NDK that the recipe pulls from CIPD.
ndkPath = systemNdkPath
}
defaultConfig {
applicationId = "com.example.myapplication"
minSdk = 24

View File

@ -30,15 +30,6 @@ android {
namespace = "com.example.release_smoke_test"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -29,15 +29,7 @@ if (flutterVersionName == null) {
android {
namespace "com.example.spell_check"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8

View File

@ -12,15 +12,6 @@ android {
namespace "com.yourcompany.integration_ui"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -30,15 +30,6 @@ android {
namespace = "dev.flutter.manual_tests"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -30,15 +30,6 @@ android {
namespace = "com.example.tracing_tests"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -11,15 +11,6 @@ android {
namespace "com.example.view"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -11,15 +11,6 @@ android {
namespace = "io.flutter.examples.hello_world"
compileSdk = flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
val systemNdkPath: String? = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

View File

@ -29,15 +29,6 @@ android {
namespace "com.example.image_list"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -11,15 +11,6 @@ android {
namespace "io.flutter.examples.Layers"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -29,15 +29,6 @@ android {
namespace "com.example.platformchannel"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -29,15 +29,6 @@ android {
namespace "io.flutter.examples.platform_view"
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -1,3 +0,0 @@
# Empty file to trick the Android Gradle Plugin to download the NDK. This is because AGP requires
# the NDK in order to strip debug symbols from native libraries, does not download it in that case
# (instead, AGP only downloads it when AGP thinks it needs the NDK to build a native library).

View File

@ -62,7 +62,7 @@ class FlutterExtension {
* Chosen as default version of the AGP version below as found in
* https://developer.android.com/studio/projects/install-ndk#default-ndk-per-agp.
*/
public final String ndkVersion = "26.3.11579264"
public final String ndkVersion = "26.1.10909125"
/**
* Specifies the relative directory to the Flutter project directory.
@ -279,7 +279,6 @@ class FlutterPlugin implements Plugin<Project> {
extension.flutterVersionName = flutterVersionName ?: "1.0"
this.addFlutterTasks(project)
forceNdkDownload(project, flutterRootPath)
// By default, assembling APKs generates fat APKs if multiple platforms are passed.
// Configuring split per ABI allows to generate separate APKs for each abi.
@ -860,36 +859,6 @@ class FlutterPlugin implements Plugin<Project> {
return version2
}
private void forceNdkDownload(Project gradleProject, String flutterSdkRootPath) {
// If the project is already configuring a native build, we don't need to do anything.
Boolean forcingNotRequired = gradleProject.android.externalNativeBuild.cmake.path != null
if (forcingNotRequired) {
return
}
// Otherwise, point to an empty CMakeLists.txt, and ignore associated warnings.
gradleProject.android {
externalNativeBuild {
cmake {
// Respect the existing configuration if it exists - the NDK will already be
// downloaded in this case.
path = flutterSdkRootPath + "/packages/flutter_tools/gradle/src/main/groovy/CMakeLists.txt"
}
}
defaultConfig {
externalNativeBuild {
cmake {
// CMake will print warnings when you try to build an empty project.
// These arguments silence the warnings - our project is intentionally
// empty.
arguments("-Wno-dev", "--no-warn-unused-cli")
}
}
}
}
}
/** Prints error message and fix for any plugin compileSdkVersion or ndkVersion that are higher than the project. */
private void detectLowCompileSdkVersionOrNdkVersion() {
project.afterEvaluate {

View File

@ -26,17 +26,11 @@ if (flutterVersionName == null) {
}
android {
namespace 'com.example.integration_test_example'
compileSdk flutter.compileSdkVersion
// Flutter's CI installs the NDK at a non-standard path.
// This non-standard structure is initially created by
// https://github.com/flutter/engine/blob/3.27.0/tools/android_sdk/create_cipd_packages.sh.
String systemNdkPath = System.getenv("ANDROID_NDK_PATH")
if (systemNdkPath != null) {
ndkVersion = flutter.ndkVersion
ndkPath = systemNdkPath
// Conditional for compatibility with AGP <4.2.
if (project.android.hasProperty("namespace")) {
namespace 'com.example.integration_test_example'
}
compileSdk flutter.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8