Android thumbnail

Android Studioで作成したアプリを実行しようとすると「Application Installation Failed」というエラーが発生しました。

とりえあず問題が解決したので忘れないうちにまとめておきます。

状況

正常に実行できるプロジェクトのディレクトリを変更した後、デバッグを実行すると次のようなエラーが発生しました。

エラー内容

Android Studio - Application Installation Failed

Installation failed with message Failed to finalize session: INSTALL_FAILED_INVALID_APK: Split lib_slice_0_apk was defined multiple times.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.

WARNING: Uninstalling will remove the application data!

Do you want to uninstall the existing aplication?

OK or Cancel

手動でアプリをアンインストールをしても効果なし。

エミュレータを新規作成してで実行しても変化なし。

アプリをインストールしたことのない端末でも同じエラーが出てくるので根本的にどこかで問題が発生しているよう。

対処方法

こちらのサイトの回答を試したところ、無事エラーが解決しました。

Android Studio - File, Settings

Android Studio File => Settings

Android Studio - File, Settings, Build, Instant Run

Build, Exception, Deployment => Instant Run (off)

Instant Runを無効化してAndroid Studioを再起動すると、エミュレータ・実機ともに表示されていたエラーが解決しました。

Instant Runとは

今回無効化した「Instant Run」とはどういった機能なのか。

Android アプリ開発中に動いているアプリを インストールし直すことなく 実行中に動的に修正することができる仕組みです。エミュレータだけでなく実機でも動きます。 Java だと Hot Code Replace とか、 Visual Studio だと Edit and Continue とか呼ばれるやつです。

Take Instant Run. It’s a feature in Android Studio that uses ✨magic✨ to significantly reduce the build and deploy times for incremental code changes during your coding / testing / debugging lifecycle.

「Instant Run」はその名の通り、アプリのインストールと実行を高速化する機能のようです。

かなり便利な機能のようですが、Android Studioに慣れるまでは無効化しておこうと思います。

 

【Android】Application Installation Failedの対処方法
Tagged on:

コメントを残す