Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve "Namespace not specified" error in Flutter for a library without an updated version?

I'm working on a Flutter project, targeting Android SDK version 35. While building the project, I encountered the following error:

gradle version 8.9

Flutter 3.24.3

Error: Namespace not specified. Specify a namespace in the module's build file: /Users/mac/.pub-cache/hosted/pub.dev/agora_rtm-1.5.9/android/build.gradle. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.

The issue seems to be related to older libraries, like agora_rtm , which don't have a namespace specified in their build.gradle file, as required by the newer Android build system.

Unfortunately, this specific library doesn't have an updated version that addresses the issue. Is there a workaround or a recommended way to add the namespace in such cases, without relying on an official update?

Any help would be appreciated!

like image 817
Khuram Shabbir Avatar asked Oct 25 '25 21:10

Khuram Shabbir


1 Answers

This issue happenes when a older library is implemented in newer version of the language this issue can be solved by 2 solutions:

  1. either upgrading the library (In your case agora_rtm: ^1.5.9) to latest version (agora_rtm: ^2.2.1)

  2. or downgrading your flutter to the library's supported version (from flutter 3.24.3 to a flutter version which is supported by agora_rtm 1.5.9 may be around flutter 3.16.1).

I hope this helps and if problem persists feel free to reach me i will try my best.

Update :

I got the same problem as you just today for using whatsapp_share2 package I got same error as you

Then i had added ~ namespace "com.whatsapp.share2" ~ line in android { } section of build.gradle file of the module in your case it will be in this path "/Users/mac/.pub-cache/hosted/pub.dev/agora_rtm-1.5.9/android/build.gradle" in your case

Then you will get error for android manifest for the package so you have to remove package name from the module's androidmanifest package then run the project again and app was running on phone.

This will probably solve your error without upgrading the package or using old version of flutter.

hope this helps

like image 179
286_Zeel godhani Avatar answered Oct 27 '25 13:10

286_Zeel godhani