Repository: flutter
Issue: New flutter plugin won't compile
Labels: platform-android,tool,t: gradle,a: build,P2,a: plugins,team-android,triaged-android

I'm trying to get a flutter plugin project to compile.

Having tried a number of things with no success I decided to create a new project using the following steps:

```
flutter create --template=plugin -a java -i objc here 

All done!
[✓] Flutter: is fully installed. (Channel stable, v1.17.4, on Linux, locale en_AU.UTF-8)
[✓] Android toolchain - develop for Android devices: is fully installed. (Android SDK version 30.0.0)
[✓] Android Studio: is fully installed. (version 4.0)
[!] Connected device: is not available.


```
```
cd here
flutter build aar
Running Gradle task 'assembleAarDebug'...                               
Running Gradle task 'assembleAarDebug'... Done                      1.2s
> Task :assembleAarDebug UP-TO-DATE
> Task :preBuild UP-TO-DATE
> Task :preDebugBuild UP-TO-DATE
> Task :compileDebugAidl NO-SOURCE
> Task :compileDebugRenderscript NO-SOURCE
> Task :checkDebugManifest
> Task :generateDebugBuildConfig
> Task :generateDebugResValues
> Task :generateDebugResources
> Task :packageDebugResources
> Task :mergeDebugShaders
> Task :compileDebugShaders
> Task :generateDebugAssets
> Task :packageDebugAssets
> Task :packageDebugRenderscript NO-SOURCE
> Task :processDebugJavaRes NO-SOURCE
> Task :mergeDebugJniLibFolders
> Task :prepareLintJarForPublish
> Task :parseDebugLibraryResources
> Task :processDebugManifest
> Task :mergeDebugNativeLibs
> Task :stripDebugDebugSymbols
> Task :transformNativeLibsWithSyncJniLibsForDebug
> Task :javaPreCompileDebug
> Task :generateDebugRFile

> Task :compileDebugJavaWithJavac FAILED
17 actionable tasks: 17 executed

/home/bsutton/git/test/here/android/src/main/java/com/example/here/HerePlugin.java:3: error: cannot find symbol
import androidx.annotation.NonNull;
                          ^
  symbol:   class NonNull
  location: package androidx.annotation
/home/bsutton/git/test/here/android/src/main/java/com/example/here/HerePlugin.java:21: error: cannot find symbol
  public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
                                  ^
  symbol:   class NonNull
  location: class HerePlugin
/home/bsutton/git/test/here/android/src/main/java/com/example/here/HerePlugin.java:41: error: cannot find symbol
  public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
                            ^
  symbol:   class NonNull
  location: class HerePlugin
/home/bsutton/git/test/here/android/src/main/java/com/example/here/HerePlugin.java:41: error: cannot find symbol
  public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
                                                      ^
  symbol:   class NonNull
  location: class HerePlugin
/home/bsutton/git/test/here/android/src/main/java/com/example/here/HerePlugin.java:50: error: cannot find symbol
  public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
                                    ^
  symbol:   class NonNull
  location: class HerePlugin
Note: /home/bsutton/git/test/here/android/src/main/java/com/example/here/HerePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
5 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s


Gradle task assembleAarDebug failed with exit code 0.
```

```
flutter doctor -v
[✓] Flutter (Channel stable, v1.17.4, on Linux, locale en_AU.UTF-8)
    • Flutter version 1.17.4 at /home/bsutton/apps/flutter
    • Framework revision 1ad9baa8b9 (9 days ago), 2020-06-17 14:41:16 -0700
    • Engine revision ee76268252
    • Dart version 2.8.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    • Android SDK at /home/bsutton/Android/Sdk
    • Platform android-30, build-tools 30.0.0
    • Java binary at: /home/bsutton/apps/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Android Studio (version 4.0)
    • Android Studio at /home/bsutton/apps/android-studio
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.
```

```
 java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1ubuntu1-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
```