error while loading app on phone from android studio - android

hi I am new to app programing, I have a Redmi 1s phone. so to load my app fro android studio I connected y phone and clicked the play button. everything looked good but the app didn't install giving the following error.
if the app is already there uninstall it, even though this was the first time I clicked play, any how I clicked on uninstall and checked the error report I showed me this .
06/19 10:36:55: Launching app
$ adb push C:\Users\ubrbcca\AndroidStudioProjects\HAPPYBIRTHDAYAADHYA\app\build\outputs\apk\app-debug.apk /data/local/tmp/com.example.android.happybirthdayaadhya
$ adb shell pm install -r "/data/local/tmp/com.example.android.happybirthdayaadhya"
open: Permission denied
open: Permission denied
pkg: /data/local/tmp/com.example.android.happybirthdayaadhya
Failure [INSTALL_CANCELED_BY_USER]
Error while Installing APK
plz help me out

Check the followings:
Go to Settings -> Permissions -> Install via USB: Uncheck your App if it's listed.
Go to Settings -> Additional Settings -> Privacy: Check the Unknown Sources option.
Finally go to Settings -> Additional Settings -> Developer options: Check the Install via USB option.
And
Turn off Miui Optimizations on Developer Settings, then Restart the phone.

Related

Deployment failed: INSTALL_FAILED_USER_RESTRICTED: Install canceled by User without allow-window popping up

normally when I use live debugging on my android (xiamo mi 8) there appears a pop up window that asks if I want to install the application. This doesnt happen anymore and Visual Studio (I use Xamarin) gives me this:
Fehler ADB0010: Deployment failed
Mono.AndroidTools.InstallFailedException: Failure
[INSTALL_FAILED_USER_RESTRICTED: Install canceled by user] bei
Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String
output, String packageName) in
E:\A_work\548\s\External\androidtools\Mono.AndroidTools\Internal\AdbOutputParsing.cs:Zeile
341.
Noteable that I dont have a drive labeled with E. What I've tried:
Disabled USB-debugging and enabled it again
Revoked the debugging-authorisation for all known devices
Disabled USB-install and enabled it again
Restarted Windows PC and the phone
Go to your Developer options and click on Revoke USB debugging authorizations and try again.
Also in Redmi devices, you might see a notification inside the notification list, just click on it and choose allow. This notification appears when you try to install the application via usb/adb

Android Studio can not install the app

I'm trying to create my first android application. For this purposes I use Android Studio 2.2.3. I have created the simple app with the single activity and which does nothing, just empty screen and no more else.
I'm developing on Meizu MX6 and I switched ON the next options:
Security App -> USB installation monitor
Settings -> Fingerprint and securiry -> Unknown sources
Settings -> Accessibility -> Developer Options -> USB debugging
Also have configured udev rules.
When I press the Run button I see this message:
Installation failed with message INSTALL_FAILED_USER_RESTRICTED.
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?
And after pressing OK this log appears in the console output:
$ adb push /home/***/dev/android/HelloAndroid/app/build/outputs/apk/app-debug.apk /data/local/tmp/com.android.hello.helloandroid
$ adb shell pm install -r "/data/local/tmp/com.android.hello.helloandroid"
pkg: /data/local/tmp/com.android.hello.helloandroid
Failure [INSTALL_FAILED_USER_RESTRICTED]
$ adb shell pm uninstall com.android.hello.helloandroid
DELETE_FAILED_INTERNAL_ERROR
Error while Installing APK
Can somebody explain how to fix this?
Check if current user have root access. And enable developer mode if you didn't do this yet.
Please build once again, after clearing temp folder and remove build directory in project.

Android error: Failure [INSTALL_CANCELED_BY_USER]

When I am trying to run the application on my device instead of Android Virtual Device It gives the error and stops running.
Showing these messages on console.
open: Permission denied
pkg: /data/local/tmp/com.example.android.sunshine
Failure [INSTALL_CANCELED_BY_USER]
$ adb shell pm uninstall com.example.android.sunshine
Unknown failure (Failure)
Go to Additional settings then select Install via USB.
I have also flashed my device with MIUI9 beta ROM and faced this issue. I got a solution to fix this bug.
Download Plex VPN from Playstore and signup.
Select China - Shenzen server and hit connect. Once it connected successfully now go to Developer Options and switch to Install via USB.
ref. Image:

My Application can't start debug mode in Android Stduio

The logcat show:
Waiting for device.
Target device: lge-nexus_4-01aa55d2b923e7a9
Uploading file local path:
C:\Users\HOXCN\AndroidStudioProjects\Horcrux\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/com.hoxcn.horcrux
No apk changes detected.
Skipping file upload, force stopping package instead.
DEVICE SHELL COMMAND:
am force-stop com.hoxcn.horcrux
Launching
application:com.hoxcn.horcrux/com.hoxcn.horcrux.ui.activity.SplashActivity.
DEVICE SHELL COMMAND:
am start -D -n
com.hoxcn.horcrux/com.hoxcn.horcrux.ui.activity.SplashActivity" -a
android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER]
cmp=com.hoxcn.horcrux/.ui.activity.SplashActivity }
Warning:
debug info can be unavailable. Please close other application using ADB: Monitor, DDMS, Eclipse
Restart ADB integration and try again(PS: I restart the adb with adb kill-server, don't work)
Waiting for process: com.hoxcn.horcrux
If i create a application with a default, the debug mode can run.
If i click run 'app', it work; if i click debug 'app', it show the message above and the screen show the dialog "Waiting for debugger" all the time
You hava to remove android:debuggable="true", because when you run/debug an application in Android Studio is signed with a debug certificate so that setting is not mandatory.Then check from console if the device is correctly attached with an adb devices. You should see it listed.
Below steps follow:
close Android Studio and any other IDE you have opened (maybe you have Eclipse also running?) and emulator instances;
Remove USB cable from PC;
3 . Run adb kill-server from console;
4 .Open Android Studio;
5 . Click on run/debug;
6 . when the window to select the device appears, attach your device to USB and USB to your computer;
enter link description here
Ok, this has happened to me. This usually occurs if you already have an apk with the same package name but different signature installed in your device. So the way to fix this is to uninstalll any existing apk's in your device.
Now in some android phones there are options for multiple user accounts and as such if an app is uninstalled it sometimes remains there for the other users. So you should go to the app options in the settings and scroll down to the very bottom. It might show your app at the bottom. Uninstall it from there too and it would work.
There is a Debug icon on the toolbar. It is located right next to the Run icon. Try to launch the app with that.
There is also a debug flag in the AndroidManifest.xml file. It is located under the application tag, and should be set to "true", as follows:
<application android:debuggable="true"> </application>
OR
Go to Tools => Android => disable adb integration and again enable it
after, Unplugged USB from device and again plugged in. Then press shift + F9
on Mac, I had the same problem.
I had an application to transfer files from my android device, this application causing the problem. All I had to do was to uninstall the androidFileTransfer application and install it again.
Good luck!
You can try to Restart your android studio and Reconnect your device..Its worked for me
Thank you

Android Studio does not install latest application on device

I'm following some tutorials about building apps in Android Studio, but for some reason it's not launching/installing the latest version of my app when I click 'run'. I have to manually uninstall the app on the phone and then click run after making changes in Android Studio for the app to get updated. Any ideas?
Here is the console output:
Waiting for device.
Target device: htc-htc_one_m8
Uploading file
local path: /home/brandon/AndroidStudioProjects/JustJava/app/build/outputs/apk/app-debug.apk
remote path: /data/local/tmp/com.example.android.justjava
No apk changes detected. Skipping file upload, force stopping package instead.
DEVICE SHELL COMMAND: am force-stop com.example.android.justjava
Launching application: com.example.android.justjava/com.example.android.justjava.MainActivity.
DEVICE SHELL COMMAND: am start -D -n "com.example.android.justjava/com.example.android.justjava.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.android.justjava/.MainActivity }
Waiting for process: com.example.android.justjava
Connected to the target VM, address: 'localhost:8638', transport: 'socket'
Disconnected from the target VM, address: 'localhost:8638', transport: 'socket'
No apk changes detected. Skipping file upload, force stopping package instead.
Android Studio thinks that there are no changes and doesn't install the new APK. A workaround is to disable the "Skip installation if APK has not changed" option in Run > Edit Configurations.
I'm using Android Studio 1.4
Source: https://code.google.com/p/android/issues/detail?id=160901
Android Studio thinks that there are no changes and doesn't install the new APK. A workaround is to disable the "Skip installation if APK has not changed" option in Run > Edit Configurations >Android Application > app >Miscellaneous .
Then uncheck "Skip installation if APK has not changed".
Another problem like this is instant Run you can manage it by :- Just go to "File -> Settings -> Build, Execution, Deployement -> Instant Run" and just disable it. With this Android Studio builds from scratch each time but it's better than not building it right.
This is actually a bug
you can find more info Android Open Source Project - Issue Tracker
Disabling instant run option in edit configuration and adding -r flag to the install flags is best work around for now.!
option in Run > Edit Configurations >Android Application > app >Miscellaneous . Then uncheck "Skip installation if APK has not changed".
THEN --> option in Build > clean project and rebuild project
and reinstall APK in your device.
THIS WORKS FINE FOR ME, HOPE THIS HELP OTHER ALSO
Another reason why the app might fail to install/start is if you've set up a "work profile".
The app might still be installed in your "work" profile and thus won't be re-installed nor uninstalled when starting through Android Studio. The "main"-profile portion of the app is "disabled" though and thus the activity can't be started.
Solution: manually uninstall the work-app, then redeploy from Android Studio.
Sometimes when I get this I just kill the app on the device, then run it. Throw in a log statement to clarify you're on the right build, just something that you know you changed for this build.
I have tried all of above solution but didn't work for me.
I solved by Opening a new project or some other existing project (being in current project) in a new window and then I closed the previous one..
I opened again the previous one and clicked on run and it worked for me like a charm..:)
Run on a Phone
Set up your device as follows:
Connect your device to your development machine with a USB cable. If you're developing on Windows, you might need to install the appropriate USB driver for your device. For help installing drivers, see the OEM USB Drivers document.
Enable USB debugging on your device by going to Settings > Developer options.
Note: On Android 4.2 and newer, Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options.
Run the app from Android Studio as follows:
In Android Studio, click the app module in the Project window and then select Run > Run (or click Run in the toolbar).
In the Select Deployment Target window, select your device, and click OK.
Please refer the link

Categories

Resources