エラー内容
FlutterをAndroid12で実行したときに下記のエラーが出ていた。
Error: ADB exited with exit code 1
Performing Streamed Install
adb: failed to install path/build/app/outputs/flutter-apk/app.apk: Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl764624764.tmp/base.apk (at Binary XML file line #21): intent tag may have at most one action.]
Error: Failed to install APK again.
Error launching application on Pixel 4.
解決方法
下記の部分が重要で、intent タグは最大1つのactionタグしか持てないらしい。
intent tag may have at most one action.
# intent タグは最大1つのアクションを持つことができます。
下記のようにAndroidManifest.xmlの内容を変更する!
変更前
/android/app/src/main/AndroidManifest.xml
<queries>
<intent>
<action android:name="android.support.customtabs.action.CustomTabsService" />
<action android:name="android.speech.RecognitionService" />
</intent>
</queries>
変更後
/android/app/src/main/AndroidManifest.xml
<queries>
<intent>
<action android:name="android.support.customtabs.action.CustomTabsService" />
</intent>
<intent>
<action android:name="android.speech.RecognitionService" />
</intent>
</queries>
これでAndroid12で実行できるようになりました!!
参考
Flutterから始めてAndroidよくわかってないマンですがとりあえず解決して良かったです。下記参考になりました。
Android11からなってたっぽい?誰かの参考になれば嬉しいです。