'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?



Solution 1:[1]

leave this line in there, but also 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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 snachmsm