Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of namespace property to support Android Gradle Plugin (A… #109

Closed
wants to merge 1 commit into from

Conversation

Skyost
Copy link
Contributor

@Skyost Skyost commented May 13, 2023

Description

This PR adds support of namespace property to support Android Gradle Plugin (AGP) 8. It fixes the following error :

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':game_services'.
> 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 --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 'bundleRelease'...                           2 150ms
Gradle task bundleRelease failed with exit code 1

See flutter/flutter#125181 (comment).

Upgrade instructions

All Flutter projects should upgrade their child Android project to use AGP 8. In the android/build.gradle :

buildscript {
  // ...

  dependencies {
    classpath 'com.android.tools.build:gradle:8.0.1'
    // ...
  }
}

Also, a namespace is required in the android section of android/app/build.gradle :

android {
  // ...
  namespace 'your.namespace'
}

Note

There's a way to still support AGP 4.2. All we have to do is :

if (project.android.hasProperty("namespace")) {
  namespace 'com.abedalkareem.games_services'
}

But I'm not sure that it's the best idea as AGP 4.2 is old. As you want, I can adapt my PR if you ask to 🙂

…GP) 8

This PR add support of namespace property to support Android Gradle Plugin (AGP) 8. Projects with AGP < 4.2 will not supported anymore.
@Skyost Skyost closed this May 13, 2023
@Skyost Skyost deleted the patch-1 branch May 13, 2023 12:29
@Skyost
Copy link
Contributor Author

Skyost commented May 13, 2023

Oops, wrong branch name ! Will submit a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant