# Namespace not specified. Specify a namespace in the module's build file

**URL:** <https://forum.ionicframework.com/t/namespace-not-specified-specify-a-namespace-in-the-modules-build-file/245691>\
**Category:** Capacitor\
**Created:** [December 18, 2024, 2:58pm UTC](https://forum.ionicframework.com/t/namespace-not-specified-specify-a-namespace-in-the-modules-build-file/245691 "2024-12-18T14:58:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dev3-test](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dev3-test](https://forum.ionicframework.com/u/dev3-test)\
**Post date:** [December 18, 2024, 2:58pm UTC](https://forum.ionicframework.com/t/namespace-not-specified-specify-a-namespace-in-the-modules-build-file/245691/1 "2024-12-18T14:58:55Z")

</div>

Olá, saudações a todos! Alguém já passou por esse problema ao tentar gerar um APK no Android Studio?

Android Studio: Jellyfish | 2023.3.1

**Ionic:**  
Ionic CLI : 7.0.0 (C:\Users\tresa\AppData\Roaming\npm\node\_modules@ionic\cli)  
Ionic Framework : @ionic/angular 6.1.2  
@angular-devkit/build-angular : 13.0.4  
@angular-devkit/schematics : 13.0.4  
@angular/cli : 13.0.4  
@ionic/angular-toolkit : 5.0.3

**Capacitor:**  
Capacitor CLI : 3.4.1  
@capacitor/android : 3.5.1  
@capacitor/core : 3.5.1  
@capacitor/ios : not installed

**Utility:**  
cordova-res : not installed globally  
native-run : 1.5.0

**System:**  
NodeJS : v18.19.1 (C:\Program Files\nodejs\node.exe)  
npm : 10.2.4  
OS : Windows 10

Namespace not specified. Specify a namespace in the module’s build file. See [Configure the app module &nbsp;|&nbsp; Android Studio &nbsp;|&nbsp; Android Developers](https://d.android.com/r/tools/upgrade-assistant/set-namespace) for information about setting the namespace.

If you’ve specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to [Use the Android Gradle plugin Upgrade Assistant &nbsp;|&nbsp; Android Studio &nbsp;|&nbsp; Android Developers](https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant) for general information about using the AGP Upgrade Assistant.

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/7/3/73ecc0817575b15e52e089fa87365bafabe8dbe4.png)

---

<div class="post-metadata">

**Author:** ![twestrick](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/twestrick/32/136131_2.png) [@twestrick](https://forum.ionicframework.com/u/twestrick)\
**Post date:** [December 18, 2024, 3:25pm UTC](https://forum.ionicframework.com/t/namespace-not-specified-specify-a-namespace-in-the-modules-build-file/245691/2 "2024-12-18T15:25:13Z")

</div>

From the error message, it looks like you are trying to use Gradle 9.

Capacitor 3 uses Gradle 7 ([source](https://capacitorjs.com/docs/v3/updating/3-0#update-gradle-to-70)) so you probably need to downgrade.

In Android Studio go to:

- File → Project Structure… → Project

Then change Gradle Version to 7.0 and Android Gradle Plugin Version to 4.2.0.

---

<div class="post-metadata">

**Author:** ![dev3-test](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dev3-test](https://forum.ionicframework.com/u/dev3-test)\
**Post date:** [December 18, 2024, 3:58pm UTC](https://forum.ionicframework.com/t/namespace-not-specified-specify-a-namespace-in-the-modules-build-file/245691/3 "2024-12-18T15:58:16Z")

</div>

Olá, obrigado por contribuir!

Mudou o erro agora, pelo que entendi esta pedindo para mudar a versão do java para 17.0.10, mas não tenho certeza se seria uma boa ideia atualizar essa versão

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/d/f/df3b433b3aa388c326b3996d8053dba2ee7417e5.png)

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/c/4/c448f74d234184390b9babfa6796d5be5907fb3b.png)

---

<div class="post-metadata">

**Author:** ![twestrick](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/twestrick/32/136131_2.png) [@twestrick](https://forum.ionicframework.com/u/twestrick)\
**Post date:** [December 18, 2024, 4:02pm UTC](https://forum.ionicframework.com/t/namespace-not-specified-specify-a-namespace-in-the-modules-build-file/245691/4 "2024-12-18T16:02:52Z")

</div>

It should be fine to downgrade. Looks like you need to be on Java 16 with Gradle 7- [Compatibility Matrix](https://docs.gradle.org/current/userguide/compatibility.html#java_runtime)

---

<div class="post-metadata">

**Author:** ![dev3-test](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dev3-test](https://forum.ionicframework.com/u/dev3-test)\
**Post date:** [December 18, 2024, 5:34pm UTC](https://forum.ionicframework.com/t/namespace-not-specified-specify-a-namespace-in-the-modules-build-file/245691/5 "2024-12-18T17:34:26Z")

</div>

Atualizei a versão do java 17 para 16:

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/c/0/c0cba836c0fcd6b7432a7bab6929a533feab3736.png)

Mas estou tendo este retorno abaixo:

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/2/c/2cd3bce12b65445a3746baf8b1acb606bd9eff71.png)

Fiz algumas pesquisas e na tentativa de fazer funcionar, ajustei a versão do https://services.gradle.org/distributions/gradle-7.0-bin.zip para 7.0.2 e mesmo assim não deu certo.

O meu build.gradle esta assim:

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/1/2/1272c4b44bc8ea08ffd5263b905c3f532dd120c1.png)

E as versões da estrutura assim:

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/6/e/6e3ecfbb30980e318a55a4de82dcef1c44a547a0.png)

---

<div class="post-metadata">

**Author:** ![twestrick](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/twestrick/32/136131_2.png) [@twestrick](https://forum.ionicframework.com/u/twestrick)\
**Post date:** [December 18, 2024, 5:39pm UTC](https://forum.ionicframework.com/t/namespace-not-specified-specify-a-namespace-in-the-modules-build-file/245691/6 "2024-12-18T17:39:30Z")

</div>

Trying restarting your computer 🙂 I had to do that for a different Java version to take affect in Android Studio.

After that, do a Gradle Sync and Clean/Rebuild - [Troubleshooting Android Issues | Capacitor Documentation](https://capacitorjs.com/docs/android/troubleshooting#gradle-sync)

---

<div class="post-metadata">

**Author:** ![dev3-test](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dev3-test](https://forum.ionicframework.com/u/dev3-test)\
**Post date:** [December 19, 2024, 12:09pm UTC](https://forum.ionicframework.com/t/namespace-not-specified-specify-a-namespace-in-the-modules-build-file/245691/7 "2024-12-19T12:09:39Z")

</div>

Reiniciei a máquina, segui a documentação, e agora sigo neste retorno:

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/6/f/6fb54fb5ebcf6c81f22cf36c15b7d9fab4668ab5.png)  
 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/0/5/05a8acb3c4bce99f103454e932a3b4b5ba46e71e.png)  
 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/b/5/b505f513e995727fce518772e835bbfa38163809.png)

Estou pensando em refazer esse projeto em uma versão atualizada (fingir esquecer do tempo que levei para fazer 🙂 ), por que, testei em criar um novo projeto de teste e consigo gerar APK sem problemas.

---

<div class="post-metadata">

**Author:** ![twestrick](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/twestrick/32/136131_2.png) [@twestrick](https://forum.ionicframework.com/u/twestrick)\
**Post date:** [December 19, 2024, 12:51pm UTC](https://forum.ionicframework.com/t/namespace-not-specified-specify-a-namespace-in-the-modules-build-file/245691/8 "2024-12-19T12:51:19Z")

</div>

I’m not really sure on that error, it’s outside of my knowledge.

As you said, you would be better off upgrading to Capacitor 6 so you are on a supported version.
