Flutter突然无法将apk安装到真机中 [英] Flutter is not able to install the apk into the real device suddenly

查看:55
本文介绍了Flutter突然无法将apk安装到真机中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用 flutter,当我从设备上卸载应用程序并从终端重新运行 flutter run 时,突然一切都好了,突然无法将 apk 安装到真实设备中.它甚至没有给出任何错误,只是在安装过程中停止.

I am working with flutter currently and everything was fine suddenly when I uninstalled the app from the device and rerun flutter run from the terminal it's suddenly not able to install the apk into a real device. It's not even giving any error just getting stopped at the installation process.

是什么导致了这个问题

我正在使用 sqflite,一切都很好.所以我不得不更改架构并添加另一个失败的表.搜索 SO 回答者建议卸载该应用程序然后重新安装它(已被接受的答案).所以我这样做了,但是每次当我运行 flutter run 之后,它都没有安装 APK.

I was working with sqflite and everything was fine. So I had to change the schema and added another table which was failing. Searching on SO answerer suggested to uninstall the app then reinstall it (was accepted answer). So I did that but after every time when I am running flutter run it is not installing the APK.

我正在运行 Mac Os High Sierra 10.13.6 并运行 flutter doctor 一切正常,因为我说它工作正常但卸载后无法重新安装.

I am running Mac Os High Sierra 10.13.6 and running flutter doctor is giving everything right as I said it was working fine but not reinstalling after uninstalling.

推荐答案

问题

从主页卸载应用会导致后续的 flutter run 命令在安装阶段挂起.

Problem

Uninstalling the app from the home page would cause subsequent flutter run commands to hang at the installing stage.

Running with flutter run -v 显示它安装成功,但当 adb 尝试运行它时,Activity 无法运行.

Running with flutter run -v showed that it installed successfully but the activity would not run when adb tried to run it.

错误消息是 3 类 ${packageName}/${packagName}.MainActivity 未找到.

The error message was class 3 ${packageName}/${packagName}.MainActivity not found.

更改 android 应用程序包名称会使其再次运行,直到我从手机上手动卸载它.

Changing the android app package name would cause it to work again until I uninstalled it manually from the phone.

  1. 多次重启手机
  2. flutter clean 没用
  3. 重新启动 Android Studio
  4. 重新启动我的计算机
  5. 重新启用 USB 调试
  6. 从 USB 调试中撤销和授权我的计算机
  7. 重新启用开发者模式
  8. adb shell pm list package ${packageName} 没有在列表中显示它,所以没有什么可以清理的
  1. Rebooting the phone multiple times
  2. flutter clean didn't work
  3. Restarting Android studio
  4. Restarting my computer
  5. Re-enabling USB debugging
  6. Revoking and authorizing my computer from USB debugging
  7. Re-enabling developer mode
  8. adb shell pm list package ${packageName} didn't show it in the list so there was nothing to clean through there

永久修复

adb uninstall ${packageName} 并显示成功".现在后续的 flutter 运行完美无缺.

Permanent fix

adb uninstall ${packageName} and it showed 'Success'. Now subsequent flutter runs work perfectly.

似乎从主屏幕卸载应用程序确实会在某个缓存中的某个地方留下一些意图或活动.

It seems uninstalling apps from the home screen does leave some intent or activities in some cache somewhere.

这篇关于Flutter突然无法将apk安装到真机中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆