AGP Upgrade Assistant で 7.2 移行時にCause: manifestData.`package` must not be null

初回は、自動認識でダイアログから進むことになると思うが、

手動でやるなら以下から。


[Tools]

  ↓

[AGP Upgrade Assistant]

このステップでコケる。

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.

なんすかねこれ。

 

Gradle sync failed: Cause: manifestData.`package` must not be null

Issue Tracker にありました。

AGP namespace property and app id suffix and Safe Args plugin don't work together

Using the new namespace property in build.gradle instead of the package attribute in AndroidManifest.xml while also using a custom applicationIdSuffix breaks androidx.navigation.safeargs plugin.

👉 Gradle sync failed: Cause: manifestData.`package` must not be null - Issue Tracker
👉 AGP namespace property and app id suffix and Safe Args plugin don't work together [232107688] - Visible to Public - Issue Tracker hatena-bookmark

どうやら、namespace の新記述は、

androidx.navigation.safeargs と同時に使えないようです。

使っているか、コード内を探してみました。


[Edit]

  ↓

[Find]

  ↓

[Find in Files ...]

androidx.navigation.safeargs

...

どうやら、ツールの書き換え内容は以下の様子。

👉 AndroidManifest の package 属性による名前空間宣言が廃止される - BattleProgrammerShibata hatena-bookmark

2行だけなので直接書き換えて namespace 記述は以前の形に戻す。と。

暫定的な対応なので、以下のようにFix版リリース時に注意が必要です。

👉 java.lang.IncompatibleClassChangeError: The method 'java.lang.Class java.lang.Object.getClass()' was expected to be of type interface but instead was found to be of type virtual hatena-bookmark