When building the app, it builds fine, but when it comes to installing the app, it's not working.
This is my log when building and trying to install the app.
10/29 20:17:47: Launching app
$ adb push C:\Users\(Removed)\AndroidStudioProjects\MyFirstApp\app\build\outputs\apk\app-debug.apk /data/local/tmp/com.example.(Removed).myfirstapp
$ adb shell pm install -r "/data/local/tmp/com.example.(Removed).myfirstapp"
pkg: /data/local/tmp/com.example.(Removed).myfirstapp
android.os.TransactionTooLargeException
Error: Could not access the Package Manager. Is the system running?
$ adb shell pm uninstall com.example.(Removed).myfirstapp
Unknown failure (Failure)
Error while Installing APK
The (Removed)'s are my computers name(Not actually, just don't want to spread its real name on the internet)
Now before you go and answer "Unlock your phone!" or "Type adb stop-server", I will list you what I have tried so far.
Restarted the ADB server
UNLOCKED my phone
Restarted my phone
Restarted Android Studio
Restarted my laptop
"Clean build" the project
ADB devices does show my device(can browse it's files in the explorer)
Turned on/off the "Instant Run" thing
My code is the Hello World when creating a new project or activity, nothing changed(Not even the IDE(Fresh Install)). I would love it if someone would help me answer this question as for all the other answers have to do with an emulator(Which none of the answers worked).
Related
I have updated android studio to Android Studio v2.3.3 (June 2017) and adb stopped showing logs when I launch app on android studio emulator
The log shows:
07/11 13:08:17: Launching app
$ adb push C:\Users\1\AndroidStudioProjects\Don'tWakeMeApp4\app\build\outputs\apk\app-debug.apk /data/local/tmp/oleksandr.ivanets.dontwakemeapp
$ adb shell pm install -r "/data/local/tmp/oleksandr.ivanets.dontwakemeapp"
Success
$ adb shell am start -n "oleksandr.ivanets.dontwakemeapp/oleksandr.ivanets.dontwakemeapp.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 4429 on device Nexus_5X_API_26 [emulator-5554]
Click on below link
http://adbshell.com/downloads
and download the first link with name ADB Kits ( contains adb.exe and necessary .dll files).
After downloading replace these files with the ones in the path
Android/Sdk/platform-tools/
Now click on adb.exe and it will open cmd and will start the adb server.
Now it will detect the device and no problem. OOOOOllllaaaaa.....
If the Problem persists again then do the same... save the folder
somewhere.... just replace files... it will detect the device
automatically then
Preface: Although my answer focuses on Android Studio's perspective of ADB errors, I'm sure it is helpful for Windows ADB debugging in general!
#sHaRkBoY 's answer helped me look in the right direction. I used to get "Unable to detect adb version, adb output:" on Android Studio while trying to "run" the app onto the phone... and no devices showed up when phone was connected to PC.
I had tried all these (from different SO answers) but none of them worked!!!:
"Invalidate cache and restart" from File toolbar.
Turn off and turn on USB debugging on phone multiple times
Experimented with "MTP", "PTP", "Midi" and "Charging" modes to see if ADB detects something...
Checked my anti-virus software to see if adding exceptions to the adb directory works...
Installed various unnecessary C++ re-distributables
Tried a different USB cable (and USB port)
Restarted Android Studio and PC
and even uninstalled and re-installed Android studio!
The problem finally was that the platform_tools\adb.exe file downloaded by the official SDK tool manager was corrupted! So I used to get windows error code 0xc0000142 on launching adb.exe from command prompt! :(
SOLUTION:
For future readers (and victims xD) of the above ADB problem, please do the following:
Firstly, add the platform_tools\ directory into the system path environment variable.
Go ahead and replace the following 3 files in your platform_tools (C:\Users\{YourAccount}\AppData\Local\Android\Sdk\platform-tools) directory. (Please backup the same folder before, just in case.)
ADB kit (internal version number: 32)
Note: Please prefer this ADB kit (exe and dll files), compared to #sHaRkBoY 's ADB kit (2.0.0.0), since it has an updated version of AdbWinUsbApi.dll (2.0.0.1), where a race condition issue has been fixed!
I hope my answer saves your from the traumatic experience I went through while troubleshooting magical ADB for an entire day! :)
I am building an app with ai2 but I have spend hours trying to get their emulator to work, so I have exported myapp.apk and I am trying to launch it on android studio emulator.
I have followed several tuto included the answer proposed by Tarek on that thread But I am getting and error on cmd.
Here is what I tried:
run android studio as administrator, run the emulator via the AVD manager, waited until it's started.
move myapp.apk in the sdk/platform-tools folder
created a run.bat file in this folder and wrote CMD in it5. copy your desired apk to the same folder
double click on run.bat and wrote: adb install r- "myapp.apk"
Here I am getting an error on CMD: error device not found -waiting for device-. I don't understand because my emulator is running.
I have also tried to launch the emulator without starting android studio with this command emulator -avd <avd_name> [<options>] but I get this message "the system cannot find the file specified".
The error message appears because adb cannot connect to the device although it is running. This is not supposed to happen, but it does from time to time.
You can always check if adb can see the emulator by running adb devices, which should result in a list of devices it can see. If this list is empty, the device is not found. You can resolve this by adb kill-server, waiting a couple of seconds and then running adb start-server. Try running adb devices again, and the device should be listed, and the installation should succeed.
Starting an emulator can be done by running emulator #<device-name> [options]. The device name can be found by running android list avd. This will result in a list of devices of which the <device-name> will also be listed.
I need to uninstall some package on my Android phone. This app is not listed by the Application Manager
Using Terminal Emulator, I can see the package using pm list packages | grep com.mycompany.mypackage
However pm uninstall com.mycompany.mypackage gives me
Failed to connect to dumpstate server
Killed
Since pm sees the package I would think I am not that far.
I also tried abd uninstall com.mycompany.mypackage which just stalls at
- waiting for device -
It may be noteworthy that this package is an Android Wear App. Hence it contains a mobile app which wraps a wearable APK (which gets deployed on the wearable). For clarity I am only caring about the phone for now.
Note: Rooting the device is not an option.
Can I get rid of this package from Terminal Emulator?
I had to go adb shell on Computer --USB--> Phone, which I was trying to avoid.
Terminal Emulator clearly doesn't have the same reach as adb shell
Follow the step to enable the debug mode on your device until you get something when you run
adb devices
http://www.companionlink.com/support/kb/Enable_Android_USB_Debugging_Mode
And try again with
adb uninstall your.package.name
I'm a beginner of android developing. I'm working in a project requires google map api.
I followed the success examples posted on Stackoverflow step by step and downloaded com.android.vending-20140218.apk and com.google.android.gms-20140218.apk. Then I copy and paste these two apk files in the same direction of my adb application, under ~/sdk/platform-tools. When I run adb command in my cmd window, first I navigate to my adb path, in my computer it's: A:\Eclipse\eclipse\sdk\platform-tools, then I tried to run the command: adb install com.google.android.gms-20140218.apk, but It failed. cmd shows: no device found. Waiting for device.
I tried many times on different computers. The same problems comes out and didn't get any information by google this problem. Thanks so much for any suggestion!
You should run an android emulator first that you've created. Then check the running device:
adb devices
if your emulator was detected, you could try to run your:
adb install com.google.android.gms-20140218.apk
WhenI run a project in android studio, I get this error - I/O Error: Connection refused
The emulator starts fine but doesn't pull in/reflect my project
Device connected: emulator-5554
Device is online: emulator-5554
Target device: Nexus4 [emulator-5554]
Uploading file
local path: /Users/martinsjolte/AndroidStudioProjects/FirstAPP1/Firstapp1/build/apk/Firstapp1-debug-unaligned.apk
remote path: /data/local/tmp/dk.first.Firstapp1
Installing dk.first.Firstapp1
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/dk.first.Firstapp1"
Device disconnected: emulator-5554
Launching application: dk.first.Firstapp1/dk.first.Firstapp1.MainActivity.
DEVICE SHELL COMMAND: am start -n "dk.first.Firstapp1/dk.first.Firstapp1.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
I/O Error: Connection refused
My platform is a mac osx ver.12.9.1
Ok, I don't know if i got "the" answer. but here is how I've solved the same issue on my environnement ( Windows 8/Android Studio, but same error with ADT or eclipse) :
Context of my issues :
I've got an Asus PC, and with all the application suite installed by default.
So I've found that one of this Asus app ( currently "Asus sync") was using adb and in fact, it was taking control of the emulator over my adb in the AndroidSDK directory.
How to fix as a PC user :
Go to Task manager ( right click on task bar) , and look for "adb.exe" . Then right click on it and select "Open the directory". This will bring you to the responding adb. In my case it was Asus Sync, so I just had to unistall this software and everything works fine !
How to fix as a Mac user :
Go to Activity Monitor (/Applications/Utilities/), and look for "adb". Then try to kill the process. Then look if it solve your "Connection refused" in Android studio/ADT or eclipse
If still not working you can try :
Start a emulator ( with your AVD manager)
when finished loading, Open DDMS panel (in android studio : Menu Tools > Android > Monitors DDMS)
Look if you see your current running android emulator ( listed on the Device panel)
See if this line is kind of "flashing" ( connect/disconnect).
If so, you have probably a other adb instance running in conflict
If not, you can restart adb or reinstall your SDK
Hope this could help someone !
This issue occurs when Android Debug Bridge aka ADB is not responding to the request from Android Studio. I killed the process adb.exe and started it again. This solved my problem.
If you are using a real device :
Just reconnect your device, make sure your cable are workable and you installed the proper drivers.
I had the same problem, and my problem fixed by restarting the android-studio. Hope, that will help you too.
For me the following worked(after I tried the above points mentioned by others):
I tried debugging/running anther application. It was okay. So this pointed me to the direction that the current application has some problem
if (point 1 == true) {I uninstalled the application from my phone manually }
Then re-make/rebuild the application and debug/run worked