Day 17 我們使用了 AGP Upgrade Assistant 來協助升級 Android Gradle Plugin 版本。
除了提示升級 Android Gradle Plugin 版本,
AGP Upgrade Assistant 還提示可選擇將 AndroidManifest.xml 檔案內 <manifest> 的 package 屬性搬移至 build.gradle(Module :app) 檔案內。
官方文件稱,自 AGP 7.3.0-alpha04 起,AGP 會自動產生此一設定 namespace 提示。

以下範例顯示 package 屬性是位在最外層 <manifest> 之中。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.my.work">
    <uses-feature ... />
    <uses-permission ... />
    <queries>
        <intent>
            <action android:name="android.intent.action.MAIN" />
        </intent>
    </queries>
    <application
        android:name="com.my.work.MyApp"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:supportsRtl="true"
        android:largeHeap="true"
        android:usesCleartextTraffic="true"
        android:requestLegacyExternalStorage="true"
        android:theme="@style/AppTheme">
        ...
        
     </application>
</manifest>
AndroidManifest.xml 檔案內 <manifest> 的 package 屬性。android {} 區塊,增加 namespace 宣告。示例如下:android {
    namespace = "com.example.myapp"
    ...
}
資料來源
Google for Developers - 淘汰資訊清單檔案中的 Package 屬性
Google for Developers - 設定命名空間