2017-06-03 63 views
-1

我已安裝Android Studio 2.3.2版本,我的應用程序已成功運行在模擬器以及移動設備上設備。進行一些更改後,它在移動設備上無法正常工作,但在模擬器中正常工作。Android Studio 2.3.2在工作配置文件或目標設備上的其他用戶帳戶下啓動應用程序將導致崩潰

事件日誌:

12:55 PM Instant Run performed a full build and install since 
        the installation on the device does not match the local build on disk. 
        (Don't show again) 

12:55 PM Instant Run detected that you are running on a target device that has a work profile or multiple user accounts. 
        Launching the app under a work profile or another user account on the target device will result in a crash. 
        Learn more about how to run your app under a work profile. 
+0

您所做的更改是什麼? – mdb

+1

你可以嘗試禁用_Instant Run_,有時它有一些已知的問題。 –

回答

3

使用此配置項目Launching your app in a Work profile

如果你有即時運行來運行你的應用程序,並打開使用Work profile(或其他輔助配置文件)您的應用程序,應用程序將會崩潰,因爲即時運行使用的儀表化DEX文件只能從主配置文件的用戶空間訪問。

如果要繼續使用即時運行,只需避免使用工作資料打開您的應用程序,並確保您的run configuration不使用--user user_id標誌。

如果您需要使用您的應用程序與工作資料,我們建議您創建一個新的run configuration,其中包括--user user_id標誌,指定工作資料的用戶ID。您可以通過從命令行執行adb shell pm list users來查找用戶標識。當您使用--user標誌時,Android Studio僅爲該部署禁用即時運行;當您切換到沒有--user標誌的配置時,Instant Run將再次運行。

要禁用即時運行:

  1. 打開設置或首選項對話框。
  2. 導航到構建,執行,部署>即時運行。
  3. 取消選中啓用即時運行旁邊的複選框。
+0

太棒了!謝謝。切換到安全區域並允許我的應用程序的權限。它工作正常。 –

相關問題