Generic Ionic app doesn't load in AVD - android

My android virtual device starts up fine. But when it goes to load my ionic app it says: "app-name has stopped", "Open app again" after opening the app several times it says: "app-name keeps stopping close app". My app is the base tabs ionic app.
Ionic even says launch success...
I've tried different AVDs but none have worked. Here are the stats on my current one.
I've tried running it in with ionic run android -c -1 but all it says is
emulator: Requested console port 5584: Inferring adb port 5585.
emulator: Listening for console connections on port: 5584
emulator: Serial number of this emulator (for ADB): emulator-5584
EDIT: it works on Ionic serve just doesn't load on the android virtual device.

check if you have a service using that port or a program like skype that uses that port, then close or change the port it uses.
i had to close xampp in order to emulate android.

Checking use host GPU in the android SDK manager solved the problem for me.

Related

React Native failed to compile giving Error on the Device

I'm new to the React Native application development. When I after creating project and configured my device, It gives error like below and stop responding.
BUILD SUCCESSFUL in 27s
26 actionable tasks: 1 executed, 25 up-to-date
'C:\Users\Amila' is not recognized as an internal or external command,
operable program or batch file.
info Starting the app (C:\Users\Amila Eranda\AppData\Local\Android
\Sdk/platform-tools/adb shell am start -n
com.awesomeproject/com.awesomeproject.MainActivity...
Starting: Intent { cmp=com.awesomeproject/.MainActivity }
It shows build is success but there is an error on the Device saying
Unable to load script. Make sure you're either running a metro server...
running the adb devices command shows there is a device connected to my PC. But it fails running it in the Device.
That error on your device means that your device cannot connect to the metro server running on your computer to get the js bundle. The app on your device is a temporary app used by react native to quickly download the javascript code from your computer and convert it to code your device can understand each and every time you make changes to your code. Your device must be connected to your computer either on the same wifi network (with metro bundler running in a terminal window on your computer) or through a usb cable (with usb debugging enabled on your device and adb reverse set on a command prompt on your computer).
Read this from the android documentation to find out how to enable developer options on your android device: https://developer.android.com/studio/debug/dev-options
If your android device lets you, you can create a hotspot and have your computer connect to it if you do not have wifi available and usb debugging does not work for you.
Read this from the react native documentation: https://facebook.github.io/react-native/docs/running-on-device#connecting-to-the-development-server-1

Why is "adb install (my APK)" triggering "can't find service: package"?

I am starting up an android virtual device, but I am getting:
Starting emulator for AVD 'avd.1'
pulseaudio: pa_context_connect() failed
pulseaudio: Reason: Connection refused
pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver
emulator: Listening for console connections on port: 5558
emulator: Serial number of this emulator (for ADB): emulator-5558
The emulator is coming up but I see no icons on it so I'm wondering if the errors listed above are "showstoppers"? Then when I try adb install bin/my.apk I get the error Can't find service: package. So it seems adb is not communicating with the AVD correctly. However, adb devices does show emulator-5558 listed above. Any advice would be really helpful.
You have essentially answered your own question while asking it. The root of the problem is that the emulator is not setup properly (evidenced by the system UI not loading). When Android can't boot properly, it is likely to fail to start some system services (in this case, the package service).
The solution is to recreate the emulator, possibly with a different system image (in case the one you have been using is corrupt). If you are using an official image, try switching API levels, or switch from a GMS-enabled emulator image to a non-GMS image (or vice-versa).
It also happened to me after closing the emulator while debugging. Yes, not the best idea...
The solution for me was:
Click on Tools > AVD-Manager.
Click on the arrow to bottom on the right of the new window from your (virtual) device.
Click on "Cold Boot Now".
Don't forget to enable usb debug mode and in developer option to consent data file transfer, for me it solved this issue, hope this help
You can also get this fault when delpoying to physical devices.
The solution is to restart the adb server, using:
adb kill-server

Android auto DHU - Failed to read from transport - disconnect. Exiting

When I try to connect the android auto DHU, following error occurs.
before running the DHU, I have done following steps.
connected USB with mobile
android auto app is running
adb forward tcp:5277 tcp:5277
./../extras/google/auto/desktop-head-unit
4th step getting an error :-
desktop-head-unit[54345:3905939] 00:05:51.597 WARNING: 140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.
Connecting over ADB to localhost:5277...connected.
Failed to read from transport - disconnect. Exiting...
Android Studio Version : 2.2.3
Mobile : nexus 5
Android Version : 6.0.1
Please suggest.
You should probably verify if you started the head unit server from your phone (Developer mode should be enabled on the Android Auto app)
then,
Open a terminal and type adb forward tcp:5277 tcp:5277.
Afterwards start the DHU :
cd <sdk>/extras/google/auto/
./desktop-head-unit (Windows : desktop-head-unit.exe)
The issue is need to start the Head Unit Server from android auto companion app. After that Im able to connect and see the DHU in mac.
./../extras/google/auto/desktop-head-unit
Connecting over ADB to localhost:5277...connected.
As pointed out in the documentation :
Warning: There is currently a known issue where the DHU can crash on
startup when connecting to Android Auto 4.7. To work around this
issue, we recommend that you temporarily downgrade to Android Auto 4.6
until a fix can be released in Android Auto 4.8.
Source : https://developer.android.com/training/cars/testing#running-dhu
Try to restart adb like the command "adb kill-server" and then set the tcp again.
Check if you started the head unit from the companion app
As mentioned in other replies, the head unit server needs to be running on your device. If you have multiple devices attached (for example, an emulator and a physical device) you may be attempting to connect to a device without the head unit server running. Try disconnecting all other devices and reconnecting.

Cannot Run App On Genymotion Emulator From Android Studio

My OS is Windows 7 Pro, and I installed Android Studio 2.1, which is the latest version at the moment, and I followed the instruction from this video tutoril to install and setup Genymotion, I did each step exactly as the video shows, but in the end I cannot run my app on the virtual device created in Genymotion(but in the video, it works fine), what I got is:
As shown in the screenshot, the emulator on the left is started from the Geny plugin in AS, and the right dialog is what I got after I click Run button, it seems that the virtual device is not recognized by AS.
The Event Log is:
11:18:01 PM error: could not install smartsocket listener: cannot
bind to 127.0.0.1:5037: Only one usage of each socket address
(protocol/network address/port) is normally permitted. (10048)
11:18:02 PM could not read ok from ADB Server 11:18:02 PM * failed to
start daemon * 11:18:02 PM error: cannot connect to daemon 11:18:02 PM
'C:\Users\Vincent\AppData\Local\Android\Sdk\platform-tools\adb.exe,start-server'
failed -- run manually if necessary
What I have tried so far:
Firstly, I found this post: Android Studio Unable to Find Genymotion Device, which gives a link of a discussion in google forum: https://groups.google.com/forum/#!topic/genymotion-users/ov5ANqGf3DI.
From the discussion, one named Jordan said that two things need to be done: "bridged adapter" and "port forwarding". But in the setting panel of VirtualBox on my PC, what I found is:
If I set Adapter2 as bridged adapter, the 'Port Forwarding' button will be disabled. So I cannot do both things at the same time. I tried bridged adapter first, it didn't work, and then I set it back to NAT as default, added the port forwarding rule, ran the adb command as explained in that post.
BTW, the approach they told to find the ip address didnt work for me, I could not install play store into that virtual device, so I figured out the virtual device's ip address from VirtualBox.
Anyway, neither of them works so far.
Secondly, I tried the approach in this blog: http://scrumsofanarchy.com/adb-over-wi-fi-with-genymotion-android-emulator/, and ended up with nothing, coz basically I cannot install any app into the virtual device.
Thirdly, I tried the approach in this post as well: android studio - emulator doesn't work and genymotion doesn't get recognized. My Genymotion is using the SDK installed by AS now, but that doesnt fix the issue.
I am running out of options now, any help is appreciated, thanks!
Just install GPU Debugging Tools 3.1 in Android SDK Mangaer ;-)

Error in running sample android application on an emulator

I am new in android development.
I created the sample hello world and try to run it on a emulated nexus 7 system.
I am using android studio 1.8.14.
When I run the application, I am getting this message in andoid studio:
Waiting for device.
Target device: test_nexus_7 [emulator-5554]
Uploading file
local path: C:\Users\m\AndroidStudioProjects\MyApplication\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/com.example.m.myapplication
Installing com.example.m.myapplication
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.example.m.myapplication"
Error: Could not access the Package Manager. Is the system running?
what is the problem and how can I fix it?
It may be a known bug. Does this solve your issue?
"2 Error: could not access the package manager. Is the system running?
You may have gotten this error while attempting to run an Android application on an emulator or device using Android Studio. The most common cause of this error is simple: You have to manually unlock your Android Virtual Device by swiping the “lock” icon on the screen. Security measures prevent the emulator from letting you connect the debugger before doing this."
Read more at http://www.airpair.com/android/bugs-annoying-android-developers#1vMSj7GfowjRvMLG.99
Other suggestions: wait for the emulator to fully start up, which could take longer than you expected, or try debugging on an Android device, which is faster and has access to native functionality, rather than in an emulator.

Categories

Resources