问题
Usually I build an app in Android Studio
to test an app on Phone. But this occurs when I just click the Run app
Waiting for device.
Target device: motorola-nexus_6-ZX1G227B86
Uploading file
local path: F:\HeadFirstAndroid\MateClient\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/com.diyu.org.mateclient
Installing com.diyu.org.mateclient
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.diyu.org.mateclient"
It seems that the process is stuck on the pm install
and no app is installed on my phone. What's the issue?
And other projects acts the same, hang on the install.
回答1:
I fixed this issue by going to Settings on the device -> Developer Options -> uncheck "Allow USB debugging' -> Recheck box. And next time, the software started correctly.
回答2:
I was stuck on install. Restarted the phone, and it worked.
回答3:
In my case the device was the problem. It refused any install or uninstall commands. You can easily test this via the adb command adb install [your apk file]
If the command line is stuck too, than this means that it is not "studios fault".
Also an uninstall returned Failure [DELETE_FAILED_INTERNAL_ERROR]
.
There must be something wrong with the installation-state inside of android.
I was able to solve this issue by manually installing my app via an apk file
that I dropped into my sd card. Then I used adb uninstall [my_package]
which resulted in Success
.
Finally I could install my application from Studio as normal.
回答4:
I fix this issue by unplugging the phone and re plugging it. If the problem persists, there may be something wrong with your drivers/USB cable or the ADB service.
回答5:
In my case, just run
(Mac: ^R, Windows: Shift + F10) again solved the problem.
回答6:
i think the problem is in the size of your Dex
, uninstall your app from your devise first then try cleaning your project,and run your project without pictures
回答7:
I fixed this issue by updating the OS to the latest Android version
回答8:
I fixed this issue by closing the project and reopening it. But I know this is not the only solution/may not always work.
File
> Close project
and then reopen the project.
回答9:
Might be a bit late.
The only thing that solved this for me was device reboot. Once I restarted the problem was on LG G4c and once I restarted it everything went back to normal.
回答10:
If by any chance you are using Xiaomi phones such as Redmi or whatever, you should try to toggle the "Install via USB" option.
For me, when I disabled and again tried to enable it, it gave me the error "The device is temporarily restricted". This was preventing me from installing apps and is the reason android studio was stuck at "installing apk".
So fix this, use a VPN to connect so any chinese server, preferably shanghai, and then try to enable the "Install via USB" option. Other users reported that turning of WiFi and using mobile data to enable the option also works.
来源:https://stackoverflow.com/questions/29867985/app-hang-on-install-in-android-studio