1

I just upgraded to Flutter 3.7.9 and now cannot run the app on Android.

  • On iOS and web the app runs fine
  • If I revert to Flutter 3.0.5, the Android app runs fine (that's also on a different branch since a bunch of dependencies broke with 3.7.9 and had to be fixed)

So, here is the error I get:

* What went wrong:
A problem occurred configuring project ':device_info_plus'.
> Could not resolve all artifacts for configuration ':device_info_plus:classpath'.
   > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22.
     Required by:
         project :device_info_plus
      > The consumer was configured to find a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22:
          - gradle70JavadocElements
          - gradle70RuntimeElements
          - gradle70SourcesElements
          - gradle71JavadocElements
          - gradle71RuntimeElements
          - gradle71SourcesElements
          - javadocElements
          - runtimeElementsWithFixedAttribute
          - sourcesElements
        All of them match the consumer attributes:
          - Variant 'gradle70JavadocElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22 declares a runtime of a component, and its dependencies declared externally:
              - Unmatched attributes:
                  - Provides documentation but the consumer didn't ask for it
                  - Provides javadocs but the consumer didn't ask for it
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
                  - Provides release status but the consumer didn't ask for it
          - Variant 'gradle70RuntimeElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22 declares a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
              - Unmatched attributes:
                  - Provides a library but the consumer didn't ask for it
                  - Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
                  - Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
                  - Provides release status but the consumer didn't ask for it
          - Variant 'gradle70SourcesElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22 declares a runtime of a component, and its dependencies declared externally:
              - Unmatched attributes:
                  - Provides documentation but the consumer didn't ask for it
                  - Provides sources but the consumer didn't ask for it
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Provides attribute 'org.gradle.plugin.api-version' with value '7.0' but the consumer didn't ask for it
                  - Provides release status but the consumer didn't ask for it
          - Variant 'gradle71JavadocElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22 declares a runtime of a component, and its dependencies declared externally:
              - Unmatched attributes:
                  - Provides documentation but the consumer didn't ask for it
                  - Provides javadocs but the consumer didn't ask for it
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Provides attribute 'org.gradle.plugin.api-version' with value '7.1' but the consumer didn't ask for it
                  - Provides release status but the consumer didn't ask for it
          - Variant 'gradle71RuntimeElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22 declares a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
              - Unmatched attributes:
                  - Provides a library but the consumer didn't ask for it
                  - Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
                  - Provides attribute 'org.gradle.plugin.api-version' with value '7.1' but the consumer didn't ask for it
                  - Provides release status but the consumer didn't ask for it
          - Variant 'gradle71SourcesElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22 declares a runtime of a component, and its dependencies declared externally:
              - Unmatched attributes:
                  - Provides documentation but the consumer didn't ask for it
                  - Provides sources but the consumer didn't ask for it
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Provides attribute 'org.gradle.plugin.api-version' with value '7.1' but the consumer didn't ask for it
                  - Provides release status but the consumer didn't ask for it
          - Variant 'javadocElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22 declares a runtime of a component, and its dependencies declared externally:
              - Unmatched attributes:
                  - Provides documentation but the consumer didn't ask for it
                  - Provides javadocs but the consumer didn't ask for it
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Provides release status but the consumer didn't ask for it
          - Variant 'runtimeElementsWithFixedAttribute' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22 declares a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
              - Unmatched attributes:
                  - Provides a library but the consumer didn't ask for it
                  - Provides attribute 'org.gradle.jvm.environment' with value 'standard-jvm' but the consumer didn't ask for it
                  - Provides release status but the consumer didn't ask for it
          - Variant 'sourcesElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22 declares a runtime of a component, and its dependencies declared externally:
              - Unmatched attributes:
                  - Provides documentation but the consumer didn't ask for it
                  - Provides sources but the consumer didn't ask for it
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Provides release status but the consumer didn't ask for it
        The following variants were also considered but didn't match the requested attributes:
          - Variant 'apiElementsWithFixedAttribute' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22 declares a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
          - Variant 'gradle70ApiElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22 declares a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
          - Variant 'gradle71ApiElements' capability org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22 declares a component compatible with Java 8, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
> Failed to notify project evaluation listener.
   > Could not get unknown property 'android' for project ':device_info_plus' of type org.gradle.api.Project.
   > Could not get unknown property 'android' for project ':device_info_plus' of type org.gradle.api.Project.

* 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 4s
Exception: Gradle task assembleProdDebug failed with exit code 1
Exited

Here is some more info that might be useful (retrieved with ./gradlew --version in the folder flutter/android from the root of my project)

------------------------------------------------------------
Gradle 6.5
------------------------------------------------------------

Build time:   2020-06-02 20:46:21 UTC
Revision:     a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4

Kotlin:       1.3.72
Groovy:       2.5.11
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          1.8.0_301 (Oracle Corporation 25.301-b09)
OS:           Mac OS X 10.16 x86_64

I also have device_info_plus: ^4.0.0 and this has not changed between the upgrade of Flutter. I have also tried upgrading device_info_plus to its latest version 8.1.0 but the error persists.

Do you have any other advice on how to fix this and run the app on Android on Flutter 3.7.9? It would also help if someone can verify they have been able to run Android on Flutter 3.7.9 with Java 8 or with Kotlin 1.6

UPDATE:

I ran ./gradlew wrapper --gradle-version=7.0.1 --distribution-type=bin. I didn't find a way to update Kotlin directly. Now I get a separate error:

An exception has occurred in the compiler (1.8.0_292). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.AssertionError: annotationType(): unrecognized Attribute name MODULE (class com.sun.tools.javac.util.UnsharedNameTable$NameImpl)
at ... (I'm skipping the hundreds of lines that say at some file in javac or Gradle)

From what I found this happens because I'm using Java 1.8 but I installed Java 11 and still the same error appears. The error still says 'the compiler (1.8.0_292)' and that 1.8.0_292 looks like a Java version but it's not one that I have or use anywhere. Even when I had Java 1.8 it was 1.8.0_301

Any advice on how to run the app on Android?

Nikko
  • 163
  • 2
  • 11

0 Answers0