Cordova emulator not starting - android

I am trying to use the Android emulator to install an app on it.
Unfortunately the emulator is never starting up. I use the following
command in my cordova project:
cordova emulate android
The last output I get from console is:
Waiting for emulator...
But the emulator does never start (I waited 45 minutes now).
The path variables are all correctly set and I can start the
emulator using Eclipse or Android studio but not using the
command from cordova.
Any hints?

If you can start the emulator through android studio, then as a work around start the emulator outside and run the command
cordova run android
It will deploy your app in the already running emulator.

Check emulator path settings
https://cordova.apache.org/docs/en/4.0.0/guide_platforms_android_index.md.html
If not able to execute then do :
use the alternate shell interface:
$ /path/to/project/cordova/run --emulator
Instead of relying on whichever emulator is currently enabled within the SDK, you can refer to each by the names you supply:
$ /path/to/project/cordova/run --target=NAME
Check the documentation above and see whether your PC supports virtualization or not.

I was getting the same issue, I resolved it by:
Open Android device manager, click on window -> Android Virtual Device Manager
There you will see listing of all the Android Virtual Devices, if you see any device with repairable icon on it, just click on repair and then try. It works.

I had the same problem. Though cordova started the emulator, the command line kept on saying 'Waiting for emulator...' forever.
The trick is, before running the command:
cordova run android
make sure you navigate into the android platform folder. That is, don't run the command from within the
/project folder
but instead from within
/project/platforms/android folder
That will launch your application in the Android emulator

Related

Emulator not starting automatically when running react native project in webstrom or VS code terminal

Every time if I want to run RN project I want to start an android studio and start the emulator manually and then go to the terminal and run the RN. if i run the project without starting an emulator it's giving me an error.
error I got when I run the project without starting an emulaotr
from my experience this is expected behavior. On Mac, running an iOS project is able to open the built in emulator, but never on Android. The error is just letting you know there are no devices running.
One helpful thing you can do is create a shortcut or terminal command to open your emulator without opening Android Studio, which is kind of a pain to open just to start an emulator. You can do this using something like what is mentioned here: https://stackoverflow.com/a/33487044/3218158

Error installing Android Emulator through "SDK Manager", can not manually install either

When I try to run the emulator through Android Studio, I get the message the emulator is not installed, so I try to install it. Every time I get the following error:
An error occurred while preparing SDK package Android Emulator: Connection closed at byte 320157527. Expected 323030753 bytes..
So, per this solution I tried manually installing the emulator and placing it in the [Android SDK folder]\emulator folder. Upon doing this, it would still tell me it was missing the emulator & try to install it in [Android SDK folder]\emulator-2, since the "normal" folder existed.
How do you get Android Studio to recognize manually installed packages?
Fortunately, I have Android Studio working on another PC. The only difference I could find between the two installations, was the manual install of the emulator was missing the package.xml file.
I copied this from my other PC & now everything is working perfectly!
I hope this helps someone else, or really me next time I run into this & can't remember how to fix it.

Why Android Studio is showing error : Unable to start adb server: error: could not install *smartsocket* listener

I am getting this unexpected behaviour of Android studio.It is showing me this error
'Unable to create Debug Bridge: Unable to start adb server: error: could not install smartsocket listener:'
Android studio was working fine before updating (it was 1.5), as soon as I updated to Android studio 2.0 I started facing this issue.
I checked in task manager and could not find this port(5037) being used.What is the actual cause of it I could not figure this thing out.Any help?
Are you using Genymotion?
If yes than my solution might help you. The issue is that genymotion uses its own adb server instead of Android SDK adb server (with the same port number, which is a conflict obviously). To fix this go to Genymotion -> Settings -> ADB and choose Use custom Android SDK Tools. Possible restart is needed.
Hope it will help you.
In my case Just Restart or Turn OFF or ON it will work fine..
In some cases if u use Genymotion then it conflict with the Android Studio ADB
Just Kill it and start ADB from PlateForm Tools Inside SDK

Installing phonegap app to android emulator using windows CLI

I'm trying to install my Phonegap application onto an Android AVD/Emulator. I have launched the AVD and it's registering as 5554:Nexus_S.
When using the Phonegap commands at the Windows prompt I am typing:
phonegap build android
phonegap install android
The output I get says it successfully installed the app onto the device, but it never shows up. This is the output of the install command:
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] trying to install app onto device
cp: dest file already exists: C:\Users\username\app\platforms\android\assets\www\phonegap.js
[phonegap] successfully installed onto device
I've tried variations of targeting the device using options with no luck:
--device=5554
--target=5554
Any ideas?
I figured it out. You have to specify the --emulator= in the call, so the command looks like:
phonegap install --emulator=emulator-5554 android
You can find the name/id of your running emulators by running the list-started-emulators.bat under the /platforms/android/cordova/lib/ folder in your project.
Another quick note is that sometimes even when you have started the emulator phonegap will not recognize it... so you have to start it from phonegap bat file so that the right process number is registered. to do this.
Use the following command,
1. List-emulator-images.bat : This will display available emulator images you have
2. start-emulator : This will start the emulator which will register with phonegap.
Also make sure you are running all of this from and ADMIN Enabled command prompt.
Okay, I've solved my problem. This solution may not be applied to all, but I was suffering from the same problem as I've mentioned in the comments of the question.
What did I do wrong?
I made some changes in one of the plugins.
I was working on my app and added the Vibration plugin. I made some changes in the plugin, both in the generic version [your_project_root\plugins\org.apache.cordova.vibration\src\android\Vibration.java] and also in the platform specific version [your_project_root\platforms\android\src\org\apache\cordova\vibration\Vibration.java].
But when I reverted the changes back, everything went fine.
I say it again, this solution may not be generic but can be useful for at least my type of problem.
And this gives rise to another question, can't we make changes in the Plugins?I think it is totally fine to make changes in them. Maybe I had done something wrong.

Update apk file after changes to source - Android Eclipse

Is there a way I can just update the apk file after making changes to the android source file in eclipse. I want to be able to do this without actually pressing the Run button in eclipse.
The reason I want this is because - I usually keep the emulator open in the background (since booting it up everytime takes too much time on my slow computer). And when I run the program after a previous run, eclipse just seems to hang up - even after I have stopped the app in the emulator.
So I decided to use the adb install command-line program to install on the emulator, but am unable to get the apk file updated without actually pressing on the run button in eclipse.
Actually, the Eclipse ADT plugin works like you want it to work. Everybody just run emulator once and then pressing RUN button update the application. If you have problems with this post the logcat during the run of your application.
You always can check the Build Automatically option in the Project menu option in Eclipse. Or you can Project->Clean your code, sometimes Eclipse get stuck trying to refresh all projects and dependencies.
You can un-install apk package with command line----
in linux os example:- adb shell pm uninstall -k <package name>
You can leave -k if you don't want to delete data and cache. If this command is failed then use emulator;
open settings in emulator -> apps -> your app and then stop it or un-install with emulator and it is more easy. Options are depend on emulator device.

Categories

Resources