简体   繁体   English

Android Studio-将应用程序推送到手机,不会让我

[英]Android Studio - pushing app to phone, won't let me

EDIT: running Windows 8.1 编辑:运行Windows 8.1

Fully up-to-date Android Studio detects the phone (rooted Samsung Note 3 on 5.1). 完全最新的Android Studio可以检测到手机(根植于5.1上的Samsung Note 3)。 It's compatible. 兼容。 Developer Mode is active, USB debugging on, etc. Never had a problem connecting the phone for dragging and dropping. 开发人员模式处于活动状态,USB调试已打开,等等。连接手机进行拖放操作没有问题。

However, whenever I try to put it on the phone... 但是,每当我尝试将其放在电话上时...

    Installation failed with message null.
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 application? (YES / NO)

No matter whether I press yes or no, I will get the same error. 无论我按是还是否,都会出现相同的错误。

Target device: samsung-sm_n920t-93eb26a9
Installing APK: C:\Users\user\AndroidStudioProjects\CopySunshine\app\build\outputs\apk\app-debug.apk
Uploading file to: /data/local/tmp/com.sdg.copysunshine
Installing com.sdg.copysunshine
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.fox.pac"
    pkg: /data/local/tmp/com.fox.pac
Error: java.lang.SecurityException: Neither user 2000 nor current process has android.permission.INSTALL_PACKAGES.


DEVICE SHELL COMMAND: pm uninstall com.fox.pac

I can use emulators (like Genymotion) just fine, it's just that having Android Studio / Emulators make my computer run hot at times, so I'd rather not do it if I can... 我可以很好地使用模拟器(例如Genymotion),只是让Android Studio /模拟器使我的计算机有时会热运行,所以我宁愿不这样做。

A solution I've tried is putting "android.permission.INSTALL_PACKAGES." 我尝试过的解决方案是放入“ android.permission.INSTALL_PACKAGES”。 into the Manifest but then I get a message that only system apps have that privilege. 进入清单,但随后我收到一条消息,只有系统应用程序才具有该特权。

I have another phone, a rooted S4 that running on 4.4.2. 我还有另一部手机,它是运行在4.4.2上的植根S4。 but whenever I connect that, the phone's UI crashes completely... that's a whole different issue. 但是每当我连接手机时,手机的UI就会完全崩溃……这是一个完全不同的问题。

First off, some rooting techniques screw a few things up so it could be that the root caused the problem. 首先,一些生根技术将一些事情搞砸了,因此可能是由根引起了问题。

Nonetheless, could you include which OS you are running Android Studio on? 但是,您能否包括运行Android Studio的操作系统? Did you get the promt to authenticate. 您是否收到了要进行身份验证的提示。 Maybe revoke authentocation from the developer options and try again. 也许从开发人员选项中撤消身份验证,然后重试。

I had the same problem one day and I solved it by reinstalling drivers on my computer for the device. 有一天,我遇到了同样的问题,我通过在计算机上重新安装该设备的驱动程序来解决了该问题。 Then when I run as administrator I am able to deploy my application without any problems. 然后,当我以管理员身份运行时,便可以毫无问题地部署我的应用程序。

Also try to uninstall the app from the command line. 另外,请尝试从命令行卸载应用程序。

~ adb uninstall com.yourpackagename

A few other commands to check if everything works: 其他一些命令来检查是否一切正常:

~ adb devices
~ adb install com.yourpackagename 

Not sure if this is the problem, but make sure you have installed Samsung Kies, available here: 不确定这是否是问题所在,但请确保已安装Samsung Kies,可在此处找到:

http://www.samsung.com/uk/support/usefulsoftware/KIES/ http://www.samsung.com/uk/support/usefulsoftware/KIES/

Without it you will not be able to run your Android Studio apps on Samsung devices. 没有它,您将无法在Samsung设备上运行Android Studio应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM