Skip to content

[add-to-app] error : Namespace not specified. Please specify a namespace in the module's build.gradle #126403

@LazyDave76

Description

@LazyDave76

Is there an existing issue for this?

Steps to reproduce

Create a new android app and add a new flutter module to it using steps in option 2 : https://docs.flutter.dev/add-to-app/android/project-setup

run 'flutter pub get' in module to build .android folder

sync project in android studio

Expected results

build is successful

Actual results

app fails to build.

Android studio is looking for 'namespace' setting in .android/build.gradle. adding a value manually makes the app build but this is a generated .android folder so any further runs of 'flutter pub get' to update dependencies remove any edits.

Error happens with 3.7.12-stable and 3.10.0-1.5.pre-beta

error output:


* What went wrong:
A problem occurred configuring root project 'Android'.
> A problem occurred configuring project ':flutter'.
   > Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
      > Namespace not specified. Please specify a namespace in the module's build.gradle file like so:
        
        android {
            namespace 'com.example.namespace'
        }
        
        If the package attribute is specified in the source AndroidManifest.xml, it can be migrated automatically to the namespace value in the build.gradle file using the AGP Upgrade Assistant; please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

### Code sample

<details><summary>Code sample</summary>

```dart
[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 stable, 3.7.12, on macOS 13.2 22D49 darwin-arm64, locale en-GB)
    • Flutter version 3.7.12 on channel stable at /Users/xxxx/.asdf/installs/flutter/3.7.12-stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4d9e56e694 (3 weeks ago), 2023-04-17 21:47:46 -0400
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/xxxx/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.12.1

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

[✓] Android Studio (version 2022.2)
    • Android Studio at /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.6+0-17.0.6b802.4-9586694)

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

[✓] Connected device (3 available)
    • iPhone 14 Pro (mobile) • D4CEE1AF-4892-48B9-A9D2-80C1D5F6175A • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 13.2 22D49 darwin-arm64
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 112.0.5615.137

[✓] HTTP Host Availability
    • All required HTTP hosts are available```

</details>

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: existing-appsIntegration with existing apps via the add-to-app flowfound in release: 3.11Found to occur in 3.11found in release: 3.7Found to occur in 3.7has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallytoolAffects 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