How do you enable a microphone input in the android emulator - java

I have been on a rough ride trying to do something using the Speech recognition on an android emulator.
Having finally installed the market place and the Google Voice Search app - I am so close to enabling my emulator to do what I want - recognize my speech. First I need to enable the emulator to record audio , or at least think that a microphone is present.
I believe adb used to have the -mic option - however I dont think it exists anymore.
Has anyone done this or can anyone shed some light on it.

have you seen this tutorial? see the comment:
You guys are not able to record sound
in emulator because the android
emulator doesn’t support it yet. This
code should only work on the phone.
Update
Now it is possible to record audio by android emulators, just need to enable it:
Extended controls (3 dots in emulator control bar) > Microphone > Virtual microphone uses host audio input

In 2021 there is an option in emulator settings to enable computer host microphone.

To On/Off the microphone of emulator, write the command in terminal of android studio.
for On microphone : adb emu avd hostmicon
for Off microphone: adb emu avd hostmicoff

hi try by enabling the audio recording support while creating the virtual device in emulator... While creating device go to hardware part and select new button. A dialog will appear in which select the property combo and select "Audio Recording Support" and give k and apply...
Hope it helps...
Let me know the output of it...

What version of Android is your Emulator running? I've had similar issues with audio in general when I try to run an Emulator with Android 2.2, which had no sound at all on Windows 7 32-bit. Still haven't been able to fix it, but when I swapped to an Android 2.3 emulator, the sound automatically worked. Maybe you could try this...

Related

Updated Android Studio, Logcat not working on one Android device anymore but still works on my other Android device

I googled this a lot so I believe it is appropriate to create a new question.
I updated Android Studio recently and my main Android device (ZTE, not an emulator) stopped reporting to Logcat. This device has never had a problem reporting to Logcat.
I tried all the steps from restarting my Android, to restarting Logcat, to restarting Android Studio, to Invalidate Catches / Restart... to refreshing the gradle to even resetting the Android device to factory settings. I of course checked the Logcat filters and the developer options on the phone like a 100 times.
The part which is weird to me is my other Android device (HTC) still reports to Logcat just fine with no problems at all. This means its not Android Studio, its the ZTE phone itself.
Does anyone have an idea why my ZTE wont report to Logcat anymore but my HTC has no problem reporting to Logcat after updating Android Studio? By the way I'm 99% sure its not the developer options on the ZTE as they match the developer options on the HTC exactly.
You can fix the following loop through this
Restart logcat
Change the log level to Debug (or anything else) and back to Verbose.
unplugging and plugging back in the device
running adb kill-server && adb start-server
Close Android Studio and launch ddms on the command line.
Restart Android Studio
And finally restarting the computer if all else fails.
The problem is intermittent, I think Android Studio is just buggy.
Try changing to no filters
It is also one alternative
It does not look like studio issue. Can you try changing the device USB configuration to MTP and authorise the device and toggle debugging option turning on/off.

OnePlus One not found in Android Studio on Mac

I have a strange problem while developing in Android Studio on mac and i am using OnePlus one. While debugging if a call come on my mobile adb disconnect my device and don't show it again. Help me to solve this permanently.
Only solution that i have found and which works is in following step:
Restart mac
disconnect cable from mac and OnePlus One
Kill adb server
start adb server
Revoke developer certificate and turn off developers option.
restart onePlus One
Turn on OnePlusOne and connect device with mac
Open Android Studio
Enable developer option and then enable debugging option
After I follow these steps, fingerprint dialog show and once I allow that dialog, device starts to show.
This process is time consuming. I am facing this problem on mac.
Putting the phone in airplane mode seems to have temporarily fixed the issue for me. I still need to look at the logs and figure out what is wrong, but there seems to be a bug in the latest 5.x updates for the OPO.
Are you using EasyTether? If yes, you can disable it by using the following command:
sudo kextunload /System/Library/Extensions/EasyTetherUSBEthernet.kext
If that does not work, open System Information utility and check your device manufacturer ID (Vendor ID). Copy that and paste it into your adb usb config by using
echo 0x9d17 >> ~/.android/adb_usb.ini
Then restart your macbook and mobile phone and try if it works.
There are several reasons your phone may not be getting detected properly, in my case it showed my phone in My Computers, and also asked me if I allowed my PC to debug on my phone. Yet it wasn't showing the phone in the android studio adb devices drop down menu.
All I did was, go to
Tools>Android>Enable ADB Integration
and it found my device. This is once I had installed my OPX driver that shows as a disk in My Computers and also Samsung USB driver. I'm talking about Windows here but the solution applies to Android Studio on any platform. So thought I should share.

Android Emulator: Unable to start webcam to capture picture in emulator

I have created an armeabi API 21 emulator in the AVD manager in Android Studio, set it to use the webcam as a front camera, and launched it.
The problem is that it's not able to open it, as I'm getting this error:
emulator: ERROR: camera_device_start_capturing: VIDIOC_STREAMON on camera '/dev/video0' has failed: Timer expired
emulator: ERROR: _camera_client_query_start: Cannot start camera '/dev/video0' for NV21[640x480]: Inappropriate ioctl for device
How can I solve this?
The webcam works normally using other software. The operative system is Ubuntu 14.04.
In Android Studio, go to AVD Manager, click on edit (pencil) button in Actions. After that, in next appearing window, click on Advance settings, and then scroll down and in Camera options, select webcam for front and back.
To enable Camera in your Android Emulator, just add following highlighted code in your AVD’s config.ini file. You can find the config.ini file under your <userdirectory>/.android folder.
File: ~/.android/config.ini
hw.lcd.density=160<br>
skin.name=HVGA<br>
skin.path=platforms\android-9\skins\HVGA<br>
hw.cpu.arch=arm<br>
abi.type=armeabi<br>
vm.heapSize=24<br>
image.sysdir.1=platforms\android-9\images\<br>
hw.camera=yes<br>
sdcard.size=64M<br>
In case you don’t find the config.ini file or want to enable Camera support through Android SDK and AVD Manager do the following:
Open Android SDK and AVD Manager:
Add SD Card in AVD
In the SD Card setting, set the value for Size. To enable camera, the SD Card must be enabled in Emulator.
Add Camera Support in Hardware under AVD
Now under Hardware section, click New button to add Camera hardware. It will open following Dialog box. Select Camera support from the Property dropdown and click Ok.
Enable Camera Support in Hardware
The new hardware: Camera support is visible under Hardware section. Set its value to yes and save changes by pressing Edit AVD.
Save the changes and launch the emulator.
You can try to manually edit your AVD's configuration file under
~/.android/avd/yourAvdName/config.ini
by adding this line:
hw.camera=yes
UPDATE
You can try to specify the real resolution of your webcam:
hw.camera.maxHorizontalPixels=XXX
hw.camera.maxVerticalPixels=XXX
Keep in mind that the default value for maxHorizontalPixels is 640 and for maxVerticalPixels is 480, so chaning this values may help you to solve your issues.
I had a similar issue with a slightly different error message under OS X. I turned out that everything was ok but the emulator is crashing when the camera takes too much time to initialize.
I my case I ended up closing other applications and it worked. You may want to test in a more performant computer.
I had trouble getting the camera to work under the emulator (under linux), even after setting it up in AVD as instructed here. I was helped by noticing that the camera it was trying to use was /dev/video0, but the camera I wanted was /dev/video3. A quick swap...
mv /dev/video0 /dev/video4
mv /dev/video3 /dev/video0
...did the trick
Change /dev/video6 into /dev/video0

Trouble running android wear app on emulator

I cannot seem to run this application which is supposedly ready to go to run on the Android Wear emulator.
Appreciate if someone can help me as to why this app does not actually get deployed to Watch emulator. I can see that the unaligned APK gets generated though.
I am following this guide:
http://toastdroid.com/2014/07/18/developing-watchfaces-for-android-wear/
Code is available at:
https://github.com/twotoasters/watchface-template
To install watchface you need to generate signed APK and push it to phone that is connected to that emulator, and install it there. After 1-2 minutes watchface should appear on the Wear device - if doesn't sync apps by companion app.
Also make sure that package for phone contains 'wear' part.
The key here is that you're using the emulator. If you run WatchfaceActivity.java from the Wear module on the emulator, you will see the watch appear on screen, but as an activity that can be dismissed.
If you then try to select it as the default watch face, you will be met with a black screen. I have only seen the emulator display the custom watch face (as a watch face, not a running activity) once and it seemed to have been a fluke.
The best way to develop custom watch faces is to run them as stand alone activities until it appears to be done, then go through the trouble of exporting a signed APK and run it on a real device connected to a real watch. At that point you can fix any small issues that remain.
please run you application on phone which has 4.3 or above platform.
install Android wear launcher apk on phone .
then connect wear emulator and phone using adb command.
adb -d forward tcp:5601 tcp:5601

Android Processing programming will not run application on device. How do I fix this?

I'm currently working with Processing, and I would like to code an android app. I have succeeded in being able to launch may application in the android emulator, but I am not able to get it to launch on my Galaxy 2.0 tab. I click run device, but every time I do I get a message at the end that says "waiting for device to become available". I'm thinking that I may need to point Processing to my android tablet somehow. Any ideas as to what I'm doing wrong. I'm on Windows 7.
It means your device is not being detected in the eclipse debugger tool. Did you check in Tab "Developer Options", make sure USB debugging is enabled. please refer other links you may get answer.
Click here
Device not detected in Eclipse when connected with USB cable

Categories

Resources