I am trying to run react-native android app in my nexus5 emulator
adb devices
List of devices attached
emulator-5554 device
started packager react-native start
running app - react-native run-android
Installing APK 'app-debug.apk' on 'reactnative(AVD) - 6.0'
Unable to install examples/android/app/build/outputs/apk/app-debug.apk
com.android.ddmlib.InstallException: Failed to establish session
at com.android.ddmlib.Device.installPackages(Device.java:894)
at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:113)
at com.android.builder.testing.ConnectedDevice$installPackages$0.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
at com.android.build.gradle.internal.tasks.InstallVariantTask.install(InstallVariantTask.groovy:119)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:226)
For Mi devices
for those who suffer from this, try what lironess mentions in a Github Comment
enable developer mode - In your phone, go to Settings, About phone and click on MIUI version 7 times. You’ll see a pop up which
says you are a developer now.
Go back to Settings, Additional settings, Developer options and enable USB Debugging.
Connect your phone to your PC/Mac and on the phone authorize your computer
go back to Developer options, scroll down to find Turn on MIUI optimization and disable it. Your phone will be rebooted
Try it now :)
Try : react-native run-android --deviceId YOUR_ID.
adb is known to be flaky. Try:
Restarting adb with $ adb kill-server
Restarting the emulator
Using Genymotion instead of stock Google emulator.
For your AVD emulator settings, try to make sure the "Use Host GPU" setting is checked, and relaunch the emulator and try again.
In my case, I have to run this command in
/sdklocation/platform-tools/
adb kill-server
then run again and watch for install request on the phone.
hope this help some one
For those like me having this issue in the emulator, one more tip: try to free up the available storage space in the emulator. That worked for me.
So many test apps and previous developed apps installed XD
If your device or emulator have an application having same name with the application you are building. Just remove the old one. It will resolve the issue.
If you had already installed app on device go delete it. It's work for me
Simply go to developer options and enable Install via USB below Debugging options.
Even i had the same problem,but restarting the genymotion and running the "react-native run-android" again worked for me.
Ensure genymotion is running before running the above command.
Probable Cause
I faced this issue recently , I had first developed an app called
'myApp' in CordovaJS where the app domain was com.myapp and had it
installed (this was months before I got into react ). Then when I
switched to react-native I did an app with a domain com.myapp and ran
into the same problem you are in.
So I figured out that there was conflicts when it came to domain and source .
Solution :
Uninstall the app that has a similar domain as the one that you are
installing eg com.example , then reboot your phone .
It worked for me , I hope it works for you too.
01 - Uninstall the app installed in device
03- then run
adb kill-server
02 -Then run again
react-native run-android
This issue happens to occur in Xiomi devices. In developers option, you don't have to disable MIUI optimization(disabling this won't sync your accounts) instead, enable 'USB debugging' option along with 'Install via USB' and 'USB debugging(Security settings)'.
This will solve the issue :)
Sometimes it may happened due to insufficient storage within emulator.Try something like below:
1. Stop emulator
2. Open AVD Manager -> Wipe Data
3. Start emulator and run your project.
step :1 run(kill all adb)
adb kill-server
step 2:list all connected devices(get your emulator id)
adb devices
step 3:(replace ID to listed id from step2)
react-native run-android --deviceId ID
Note: make sure your previous app uninstalled in your emulator or physical device
In MI Devices. I solve this problem by goto Developer options -> turn on Install via USB. I hope it useful!
Related
I've recenlty buyed the Xiaomi Redmi 3 for Android development but I have the following issue. The USB debugging is turned on, the ADB is connected. But when I try to install the APK file by typing the
adb install my.apk
I receive the following message:
/system/bin/pm[6]: app_process: not found
And nothing happens. When I try to install it from Android Studio it shows just like it running the app, but nothing is happening. Maybe someone have experience with dealing with that?
I fixed that by rooting the device. Don't know why it helps but I got it working.
Instead of rooting it, try this:
Go to Settings --> Additional Settings --> Privacy
Enable "Unknown Sources (Allow installation of apps from unknown sources)" option
Then try installing it. It should work.
Is the app listed as installed on your phone?
If it is, try uninstalling it and running install command again.
When I run my app from AndroidStudio 0.4.3 using Run I see Choose Device which has two sections choose a running device or Launch Emulator. I don't have a running emulator at the moment so I click the ... to launch AVD manager and start an emulator. At this point I see that under choose a running device the emulator I just launched shows up but its listed as offline.
In the past the offline status went away when the emulator was fully up and running. However, now I've noticed that when the emulator is launched fully, it no longer appears in choose a running device.
I feel like I'm always playing cat and mouse game with android studio picking up the emulator. Is there a better way to do this? Am I missing something?
Disable and then Enable ADB Integration
In Android Studio go to
Menu -> Tools
Android
Enable ADB Integration (should be checked, click to remove check)
Enable ADB Integration (should not be checked, click to add check)
Run your app again. Emulator that was previously missing from Run dialog should be available to be selected upon which to run your app.
Try to kill the adb server and restart it.
Locate your adb binary (linux/osx) or adb.exe (windows) and do:
adb kill-server
adb start-server
this should fix your problem
Even if your problem still not solved then Restart emulator.
Wipe Data and restarting emulator helped me, hope this helps to someone.
inside AVD manager, select your virtual devices, then 1 stop, 2 wipe user data, 3 cold reboot, works for me.
On Windows, running Android Studio with administrator permissions can help (in addition to restarting adb server).
Unchecking the "Enable ADB " worked for me
In Android Studio Arctic Fox (2020.3.1) it helped me to cold boot the device.
add -port 5037 on ../[some_emulator]/emu-launch-params.txt file & try again...
like image
A few days ago I started having troubles while trying to install a .apk on my Galaxy S2. I select my phone as the target, click OK and in the Console get the following error:
Failed to install AvatarRun.apk on device 'device number': timeout
Launch canceled!
Without changing anything in code and running again I can also get the error:
Failed to install AvatarRun.apk on device 'device number': device not
found com.android.ddmlib.InstallException: device not found Launch
canceled!
I have tried opening a command window and navigating to android-sdk\platform-tools and running:
adb kill-server adb start-server
This did not fix the issue.
This seems to just be a coincidence, but after failing many times I changed the minimum SDK in the Manifest from 10 to 7 and the .apk loaded on the next try, but has worked intermitently since and generates the same errors.
Can anyone suggest a method for finding what is causing this error?
After trying the fixes mentioned above, I ended up installing and reinstalling the Galaxy drivers. This didn't help. What eventually worked (so far) was to switch which USB port the Galaxy is plugged into. Once I did this everything was functioning as it should.
It may sound ridiculous, I tried all the ways suggested in Android error: Failed to install *.apk on device *: timeout
None of them works for me except unplugging the current cable and change for a new one.
There are various solutions:
Try changing the ADB connection timeout. The default is 5000; you should change it to 10000ms or so.
Window -> Preferences -> Android -> DDMS -> ADB Connection Timeout (ms)
Try to unplug and re-plug the cable. It seems that sometimes Eclipse loses the connection with Device. Sometimes you just need to plug into other USB port.
You might need to kill the ADB process and restart it.
adb kill-server and then
adb start-server
For me, the solution is to uninstall the old apk from the phone.
This problem often shows up if the computer is not fast enough. So,if you go to task manager you will see the performance. If you are watching video or running other programs at the same time while you are running your android application close other programs; at least during installing the app on device or emulator. You might even need to close internet browser.
You might need to update your computer to make it faster if you can.
Hope this helps someone:)
While installing the android application in the emulator I am getting the following error.
Please help me to resolve this error.
Error message:
emulator.exe -avd avd_name
adb wait-for-device
adb install path-to.apk
could not access the package manager. is the system running while installing android application....
You need to wait for the emulator to full start - takes a few minutes. Once it is fully started (UI on the emulator will change), it should work.
You will need to restart the app after the emulator is running and choose the running emulator when prompted.
As other have said, this error occurs because the emulator is still in the process of launching. An attempt to access the package manager, for the device, at this time causes an error.
It's just a simple timing issue. Here are the steps to avoid this error:
Wait until the emulator 'lock screen' is showing.
Run the 'app' again (^R in most IDE's).
Choose the running device (Should be the same emulator).
App should install without error.
In my case it was just that the emulator took 9 minutes to start. Wait until you see the lock icon on the emulator LCD. Or use actual tablet or phone.
Facing Same issues following Link helped solving the problem. The above solutions were not helpful for me.
deployment-failed-could-not-access-the-package-manager-is-the-system-running
By restarting server using CMD application was back to work. Open cmd (Run as administrator), open this
cd C:\Program Files (x86)\Android\android-sdk\platform-tools
(this path must specify your android-sdk installation folder )
Now, first write,
adb kill-server and then adb start-server.
Kill the process/server and restart it.! It worked.
You can avoid the error by setting default device before launching application. Launch the AVD before starting the app.
Once you see this error, wait for emulator to show lock screen. And then relaunch the app in your IDE and check the emulator again. It works for me always.
In Android studio, you can relaunch by clicking the green play button or ctrl + r.
If this error is gotten when using a rooted device's su prompt and not from emulator, disable SELinux first
setenforce 0
You may need to switch to shell user first for some pm operations
su shell
then re-run your pm command.
Same applies to am commands unavailable from su prompt.
The solution for me was to restart the IDE. I suspect that a slow emulator was hiding from view, blocking installation on my device.
Check your project build is in Debug mode not Release, I had some problem for debugging always I forget to change Release mode to Debug (Xamarin Users)
I opened my NotepadCodeLab, NotepadAdv1 project, and got this as soon as I built and ran:
[2010-11-01 14:42:48 - DeviceMonitor]Sending jdwp tracking request failed!
[2010-11-01 14:42:48 - Logcat]device not found
com.android.ddmlib.AdbCommandRejectedException: device not found
at com.android.ddmlib.AdbHelper.setDevice(AdbHelper.java:736)
at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:373)
at com.android.ddmlib.Device.executeShellCommand(Device.java:285)
at com.android.ddmuilib.logcat.LogPanel$3.run(LogPanel.java:516)
What am I missing?
Emulator or physical device? If emulator, is it already running? If it's a device, is it connected via USB?
Assuming you have the SDK installed and on your path, if you type "adb devices" into the command prompt, your device should show up. If it doesn't, follow the SDK installation instructions here:
http://developer.android.com/sdk/installing.html
If you're using a real device, don't forget the USB driver. You also have to have installed into your SDK and AVD manager the correct version for your phone. If you were upgraded to v2.2, also install v2.1.
Bizarrely, when I came back the next day (after restarting Eclipse/my computer), it worked. Should have tried that first. Thanks though :)