[Flutter] flutter_native_splashを使ったプロジェクトを複製する際の注意点

Flutterはサンプルプロジェクトを複製する際、単純にflutter-templateflutter-projectみたいにプロジェクトに合わせて名前だけ全置換するだけではダメなことが結構あるので注意が必要。

flutter_native_splashもその一つ。

flutter pub run flutter_native_splash:create

でスプラッシュ画像を生成できるが、package名を変えている場合

Not able to determinate MainActivity path. Maybe the problem is your package path OR your AndroidManifest.xml 'package' attribute on manifest.

エラーが出る。

この場合、AndroidManifest.xmlに設定しているpakage名に合わせてディレクトリ構造を変更する必要がある。

例えばpackage名がcom.example.projectの場合、android/app/src/main/kotlin以下のディレクトリ構造をandroid/app/src/main/kotlin/com/example/project/*.ktとすればよい