![NOTE] >
--compile-commands-dir
must point to an Android build output:{ /* ... */ "clangd.path": "buildtools/mac-arm64/clang/bin/clangd", "clangd.arguments": ["--compile-commands-dir=out/android_debug_unopt_arm64"] /* ... */ }... but remember to change it back when editing other parts of the engine.
The Java code for the Android embedder is located in io/flutter/
and subdirectories.
The tests are located in test/io/flutter/
, and the test runner in test_runner
.
Some notable files include:
io/flutter/embedding/android/FlutterActivity.java
: An activity that displays a full-screen Flutter UI.io/flutter/embedding/engine/FlutterJNI.java
: The Java interface for the C++ engine.io/flutter/view/TextureRegistry.java
: Registry of backend textures used by a Flutter View.It is non-trivial to get a working IDE setup for editing Java code in the Flutter engine. Some developers have had success using VSCode as an IDE for the Android Embedding, but the following instructions are for if that doesn't work, or you want to use Android Studio:
Open shell/platform/android
in Android Studio.
Configure the following:
Preferences | Build, Execution, Deployment | Gradle-Android Compiler
Command-line Options:
-Pbuild_dir="/tmp/build_dir" -Pflutter_jar="$ENGINE/src/out/android_debug_unopt_arm64/flutter.jar"
Preferences | Build, Execution, Deployment | Build Tools | Gradle
Distribution of Local Installation
with:
$ENGINE/src/third_party/gradle
Gradle SDK using Android Studio (path depends on your machine):
/Applications/Android Studio.app/Contents/jbr/Contents/Home
Sync Gradle.
At this point you should be able to open Java files in Android Studio and get code completion in the io/flutter
folder (additional, undocumented work is required for test/io/flutter
). For example, FlutterJNI.java
: