Skip to content

Examples in examples/api cannot run because of a missed step while migrating to the declarative plugins {} block #147100

@lamnhan066

Description

@lamnhan066

Steps to reproduce

  1. Open the examples/api project (master/beta/stable).
  2. Run any example on the Android platform.

The issue is caused by this line in examples/api/android/app/build.gradle:

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

It should be removed when migrating to the declarative plugins {} block.

This plugin should be moved to the bottom as well regarding to this instruction.

id "dev.flutter.flutter-gradle-plugin"

Expected results

No issue found

Actual results

Warning: unable to detect project KGP version. Skipping version checking. 
This may be because you have applied KGP after the Flutter Gradle Plugin.

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/thanhnhan/Documents/Development/Projects/Flutter/flutter/examples/api/android/app/build.gradle' line: 67

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not get unknown property 'kotlin_version' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* 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
Error: Gradle task assembleDebug failed with exit code 1

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[!] Flutter (Channel [user-branch], 3.22.0-14.0.pre.58, on macOS 14.3 23D56 darwin-arm64, locale en-VN)
    ! Flutter version 3.22.0-14.0.pre.58 on channel [user-branch] at /Users/thanhnhan/Documents/Development/Projects/Flutter/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    ! Upstream repository https://github.com/lamnhan066/flutter.git is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to https://github.com/lamnhan066/flutter.git to dismiss this error.
    • Framework revision 663be6ff4a (29 minutes ago), 2024-04-20 09:26:47 +0700
    • Engine revision 3db86b3cab
    • Dart version 3.5.0 (build 3.5.0-81.0.dev)
    • DevTools version 2.35.0-dev.8
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update
      checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/thanhnhan/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/thanhnhan/Library/Android/sdk
    • Java binary at: /Users/thanhnhan/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Users/thanhnhan/Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] IntelliJ IDEA Community Edition (version 2023.3.2)
    • IntelliJ at /Users/thanhnhan/Applications/IntelliJ IDEA Community Edition.app
    • Flutter plugin version 77.0.1
    • Dart plugin version 233.13135.65

[✓] VS Code (version 1.88.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.84.0

[✓] Connected device (5 available)
    • sdk gphone64 arm64 (mobile)     • emulator-5554             • android-arm64  • Android 14 (API 34) (emulator)
    • iPhone (mobile)                 • 00008101-000468C02608001E • ios            • iOS 17.4.1 21E236
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 14.3 23D56 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin         • macOS 14.3 23D56 darwin-arm64
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 124.0.6367.61

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    d: examplesSample code and demosfound in release: 3.19Found to occur in 3.19found in release: 3.22Found to occur in 3.22frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions