Skip to content

Java Plugin template doesn't compile #50480

Closed

Description

@gaaclarke

Steps to reproduces:

  1. flutter create -t plugin -i objc -a java JavaTest
  2. open "JavaTest/android" with Android Studio
  3. Notice the error Minimum supported Gradle version is 5.4.1. Current version is 4.10.2
  4. Press the 'fix and re-import` button
  5. Build the project, notice it doesn't build reporting errors

Errors:

It looks like everything stems from not being able to find androidx.annotation.NonNull

com/example/JavaTest/JavaTestPlugin.java |  
-- | --
error: cannot find symbol class NonNull |  
error: package io.flutter.embedding.engine.plugins does not exist |  
error: package io.flutter.plugin.common does not exist |  
error: package io.flutter.plugin.common does not exist |  
error: package io.flutter.plugin.common.MethodChannel does not exist |  
error: package io.flutter.plugin.common.MethodChannel does not exist |  
error: package io.flutter.plugin.common.PluginRegistry does not exist |  

Notes:

  • I tried to run the refactor tool to migrate to androidx and it performed a no-op

Doctor:

[✓] Flutter (Channel master, v1.14.6-pre.237, on Mac OS X 10.14.6 18G2022, locale en-US)
    • Flutter version 1.14.6-pre.237 at /Users/aaclarke/dev/flutter
    • Framework revision 6dc3bfaa98 (3 days ago), 2020-02-07 18:28:02 -0800
    • Engine revision 6158f03ef5
    • Dart version 2.8.0 (build 2.8.0-dev.8.0 514a8d4c84)

cc @blasten

Activity

  1. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    on Feb 10, 2020
  2. gaaclarke commented on Feb 10, 2020

    @gaaclarke
    MemberAuthor

    Note: adding implementation 'androidx.annotation:annotation:1.1.0' to the build.gradle got me past this error, but the next import for embedding wasn't found after that.

  3. gaaclarke commented on Feb 10, 2020

    @gaaclarke
    MemberAuthor

    Note: I was compiling from JavaTest/android/, compiling from JavaTest/example/android works.

  4. dnfield commented on Feb 10, 2020

    @dnfield
    Contributor

    This should be fixed by #50388

    That said, we might be breaking other people who don't work with the current version - @blasten is that true?

  5. blasten commented on Feb 10, 2020

    @blasten

    @dnfield I don't think so. #50388 is fixing a bug in the template, but the impact is reduced to:

    1. Running flutter build aar on a plugin project.
    2. Open the plugin with Android Studio and building the plugin individually. (This issue).

    In most cases, people test plugins using the example app.

  6. github-actions commented on Aug 23, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  7. locked as resolved and limited conversation to collaborators on Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    toolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions