flutter_cast icon indicating copy to clipboard operation
flutter_cast copied to clipboard

Error "Could not find method namespace() for arguments [fr.skyost.bonsoir] ..." when building the example

Open Gnitry opened this issue 1 year ago • 1 comments

Summary Got an error when building the example:

A problem occurred evaluating project ':bonsoir_android'.
> Could not find method namespace() for arguments [fr.skyost.bonsoir] on extension 'android' of type com.android.build.gradle.LibraryExtension.

Steps to reproduce

  • Clone repository
  • Go to example directory
  • flutter run
  • 'Android v1 embedding ' error appears
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Warning
──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It is being deprecated in favor of Android embedding v2. To migrate
your project, follow the steps at:

https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The detected reason was:

  C:\sources\flutter_cast\example\android\app\src\main\AndroidManifest.xml uses `android:name="io.flutter.app.FlutterApplication"`
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Build failed due to use of deprecated Android v1 embedding.
  • Fixing android:name="io.flutter.app.FlutterApplication" to android:name="${applicationName}" inside AndroidManifest.xml
  • flutter run
  • See another error:
Launching lib\main.dart on SM A336E in debug mode...
Upgrading build.gradle
Conflict detected between Android Studio Java version and Gradle version, upgrading Gradle version from 5.6.2 to 7.6.1.
Upgrading gradle-wrapper.properties
Warning: The plugin bonsoir_android requires Android SDK version 33.
For more information about build configuration, see https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
One or more plugins require a higher Android SDK version.
Fix this issue by adding the following to C:\sources\flutter_cast\example\android\app\build.gradle:
android {
  compileSdkVersion 33
  ...
}

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\User\AppData\Local\Pub\Cache\hosted\pub.dev\bonsoir_android-2.2.0\android\build.gradle' line: 30

* What went wrong:
A problem occurred evaluating project ':bonsoir_android'.
> Could not find method namespace() for arguments [fr.skyost.bonsoir] on extension 'android' of type com.android.build.gradle.LibraryExtension.
  • Fixing compileSdkVersion 28 to compileSdkVersion 33 inside build.gradle
  • Got an error
PS C:\sources\flutter_cast\example> flutter run
Launching lib\main.dart on SM A336E in debug mode...

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\User\AppData\Local\Pub\Cache\hosted\pub.dev\bonsoir_android-2.2.0\android\build.gradle' line: 30

* What went wrong:
A problem occurred evaluating project ':bonsoir_android'.
> Could not find method namespace() for arguments [fr.skyost.bonsoir] on extension 'android' of type com.android.build.gradle.LibraryExtension.

* 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
Running Gradle task 'assembleDebug'...                           2,251ms
Exception: Gradle task assembleDebug failed with exit code 1

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.4, on Microsoft Windows [Version 10.0.22621.1778], locale en-US)
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc4)
[✓] Visual Studio - develop for Windows (Visual Studio Community 2022 17.6.2)
[✓] Android Studio (version 2022.2)
[✓] VS Code (version 1.79.0)
[✓] Connected device (2 available)
[✓] Network resources

• No issues found!

Gnitry avatar Jun 12 '23 17:06 Gnitry

FAILURE: Build failed with an exception.

  • What went wrong: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher. The following dependencies do not satisfy the required version: project ':bonsoir' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.30

banchengcunluo avatar Sep 12 '23 17:09 banchengcunluo