Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move package from Android manifest to build files

My Android Studio claims that declaring the package in the manifest like this is deprecated:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="this.is.my.package">

The error message is:

Move package from Android manifest to build files

Declaration of a project's namespace using the package attribute of the Android manifest is deprecated in favour of a namespace declaration in build files.

But the button "Run selected steps" is disabled and I cannot click it.

How to fix this error message?

like image 360
zomega Avatar asked Sep 12 '25 05:09

zomega


1 Answers

leave this line in there, thats an old, "legacy" way from times when there were no Gradle used in Android projects... it's still used for generate R.* references for resource files

current times and Gradle-based projects: declare an applicationId and namespace in your gradle files (e.g. with same value "this.is.my.package"). some DOC in HERE, some sample below:

android {
    namespace "this.is.my.package"
    defaultConfig {
        applicationId "this.is.my.package"
        ... rest of code
like image 137
snachmsm Avatar answered Sep 13 '25 18:09

snachmsm