React-Native physical device not connecting to server - android

Here's whats happening-
react-native run-android fails giving the following error message-
"
Execution failed for task ':app:installDebug'.
com.android.builder.testing.api.DeviceException: No connected devices!
"
Here's a list of things i have done-
Connected my phone (Redmi Note 7 pro) to the laptop (uses ubuntu 18.04) using a usb cable. And followed all instructions from the react-native documentation (USB debugging etc) but the device (phone) doesnt show on using the command adb devices . I have also tried connecting the phone as a file transfer device and every other mode possible.
I have tried connecting via the wifi network (which works) but the last time i did it i had to turn off MIUI optimisation, and this led to whatsapp going haywire and i had to reinstall whatsapp. From what i know this is a necessary condition, if wireless connection is to be made to an MI phone.
Android emulator..... simply doesnt work (i have tried many SO tricks, none worked).
So is there a way to solve these issues? or is there any other method using which i can run my react-native application for debugging.
Thanks in advance :)

Ensure that Developer mode is enabled with USB debugging in the device. If USB debugging is enabled then the device id should be listed in the adb devices list. If not then try to add ADB driver for the device or a universal ADB driver.

Related

Unable to connect Android Studio to Pixel 2

I'm running Android Studio Arctic Fox 2020.3.1 Patch 2 on my Dell XPS 13-9370 running Linux Ubuntu Ubuntu 20.04.3 LTS and when I try to connect either of my two Pixel 2s via USB, Studio fails to see them. I have USB debugging enabled and have tried setting Default USB configuration to both File transfer and PTP, to no effect. I also tried swapping USB cables and all the other steps described in the Android Studio Troubleshoot Device Connections.
I should mention that I have no problem connecting Studio to my Samsung Tab A running Android 11, or to any of the emulated devices. They all connect just fine. When I plug the USB cable into the Pixel 2s, I don't even get the permission prompt, even after revoking USB permissions.
I've been knocking my head against a wall on this for a couple of days now, trying out every relevant suggestion I've found on Stack Overflow. I used to have no problem connecting my two Pixel 2 devices up until a few days ago. The problem also occurs on the previous version of Android Studio. I thought it might have something to do with several new third-party apps I installed, but I forced stop them, rebooted the device and still the problem remains.
You can hard reset your devices because in some cases that works.
Otherwise, You can use the developer options wirelessly on your phone.
Just read this article for a step by step guide for how to do this.
Use Android device for development wirelessly
are you using same usb cable for other devices in which it is working ?
try this once - open developer option and select 'Select USB Configuration' . make it mtp and also check if usb debugging is turned on.
Instead of doing it with a cable you could do it wireless just install the plugin adb wifi rest all the instructions are given when you will install that plugin.
Android WiFi ADB
Steps to do this(in short)
Connect your device to your computer using a USB cable.
Then press the button picture of a button to be pressed on the toolbar and disconnect your USB once the plugin connects your device over WiFi.
You can now deploy, run and debug your device using your WiFi connection.
NOTE: Remember that your device and your computer have to be in the same WiFi connection.
Sometimes it happens for the USB connector manager of your operating system. You can uninstall the USB connector manager from your OS Device manager and then restart your laptop. I faced this issue several times and this solution worked for me.
Try to install Genymotion Emulator and Launch it first before running your app. I did it and it helped me and i think it will be work

How can I develop my own apps for the Huawei P30 Pro?

I have been developing some apps with Xcode for my iPhone but recently I got the Huawei P30 Pro and would like to start making my own apps for it.
I've tried Android Studio for Mac but it doesn't detect my phone plus google doesn't show any results for developing apps for the Huawei.
Is it possible or is there nothing I can do as of now?
I've enabled USB Debugging on the phone and run 'ads devices' which shows my device as connected but still noting in Android Studio.
You may have accidentally revoked access to debugging try turning debugging off and back on again you NEED debugging for any form of android development. as for no documentation, that is OK your phone is new and there will not be much info on the specifics, just google stuff about android development in general.
If Android Studio doesn't detect your device, you may want to try using wifi to connect the device, I use AS on a mac every day, and the devices I have often disconnect when cabled, but with this they stay connected for days.
Connect device via cable.
Open terminal / preferred command line app.
Run command adb devices. If no device detects unplug and try again, if it continues with no device then check settings on device that usb debugging is enabled, and enabled in charging mode.
If device connected:
if only one device, run adb tcpip 5555
if multiple devices run adb -s deviceid tcpip 5555
If successful then disconnect the device
Run command adb connect 192.168.x.x:5555 with x.x being your device IP address.
If that's all done and it says connected, then you should see it in AS.

How to run app on moto 360 from android studio

I'm using the sample watchface app and have followed all the steps
(developer.android + several variations from this site) to run something on my watch but with no joy. Wondering if anyone can advise please.
Phone (moto 4G) is connected to PC by USB. USB debugging is on in Settings and Debugging over Bluetooth is on in Android Wear app. Paired watch (moto 360 2gen) has ADB Debugging enabled and Debugging over Bluetooth enabled.
Android Studio lists the phone if I run the phone module part of the app; it offers no compatible devices if I run the wearable module. Adb devices command just lists the phone. On the phone in the Android Wear app under Debugging over Bluetooth it says
Host: disconnected
Target: connected.
When I look on the phone in Settings, Apps a watchFace app has appeared but there's nothing on the watch (tried to change watch face, nothing new; no new app).
I tried
adb forward tcp:4444 localabstract:/adb-hub
adb connect localhost 4444
but the second command gives
'unable to connect to localhost:4444 ... no connection could be made because the target machine actively refused it (10061).'
I also tried
adb connect 127.0.0.1:4444
which does connect but AS says it's offline.
Can anyone help?
After trying the above procedure many times it seems that sometimes it works and sometimes it doesn't! I haven't yet found what makes the difference but suspect either (a) not leaving enough time between connecting phone and entering adb commands or (b) simple PC running too slowly.

Eclipse not detecting android device

Eclipse is not able to detect my android device even though it is connected to my computer. I had it working on my computer earlier, but my hard drive crashed so I had to reinstall/setup eclipse, and now it doesn't work. I have enabled USB debugging. I updated my USB drivers/ android devices. I tried connecting my android phone first, and then tried my tablet, but there was no change. I tried restarting the ADB server. The android project runs on the emulator, but the emulator takes so long to load and is laggy. I did a lot of research on how to fix this, but nothing is working. In my eclipse console it says, "Failed to find an AVD compatible with target 'Android 4.4W'."
if you have root, you can try to use Wireless adb via wi-fi. for this you must install from GooglePlay app like "wireless adb" run it and connect from cmd like this:
"e:\androidSDK\sdk\platform-tools\adb.exe connect 192.168.0.68:5555"
Also i recommend you to install free third-party android emulator BlueStacks, it work very fast! faster then real device connected by usb
For virtual device try Genymotion
For hardware
-first check if your device is connected - adb devices //some serial number should list. If empty, you need to install proper drivers manually.
also check in windows Device manager
Try to disable USB debugging then enabled USB debugging.
Relay! Yeah it's work.

Android Device Chooser: Cannot Detect Device

I am trying to use my Nexus 4 to run a hello world app. I'm using the Java ADT with Eclipse.
I cannot detect the device.
Nexus 4: Android 4.4.2
Java ADT: build v22.3.0-887826
Windows 7 Professional x64
Java JDK: jdk-7u51-windows-x64
ADB v1.0.31
Project build target is 4.4.2 (API 19). Minimum required version is API 8.
./adb devices shows no devices.
I am in USB debugging mode on the device. I have allowed installation of non-play-store apps.
My computer detects the phone as a media device (MTP), not as a camera (PTP).
I do not get a prompt asking me if I accept an RSA key.
Things I have tried:
Download USB drivers from here: http://developer.android.com/sdk/win-usb.html#top then:
Start > Properties > Device Manager > Portable Devices > Nexus 4 > Properties > Update Driver > Browse > {Download Folder}
I get a popup telling me that the drivers are up to date.
Changing the cable
Changing the USB port
Restarting Eclipse
Restarting the adb server (kill-server > start-server > devices)
Restarting the phone
Restarting the computer
Editing android_winusb.inf, as described here: USB driving on Android - new devices
I have tried everything I've seen on these pages:
http://developer.android.com/tools/device.html
http://androidsecurity.wordpress.com/2013/06/05/install-google-nexus-4-adb-usb-drivers-on-windows-android-studio/
Android Device Chooser -- device not showing up
How do I deploy HelloWorld app to HTC Eris Droid?
EDIT: I tried to enable ADB over wifi. So I installed ADB WiFi off the play store. It needs root permission, so I tried to root my phone using Kingo Root. Kingo Root does not work. It's giving me the message "No Device Connected!". I can transfer files from the device, and it gets detected when I plug it in, so I don't know it what capacity it "is not connected".
EDIT2: I tried to enable ADB over wifi as described here: How can I connect to Android with ADB over TCP?
adb tcpip 5555 gives me "error: device not found". Looks like inability to detect the device is a common failure mode. I suspect that fixing that will let everything else work as intended.
Android debugging via usb can be a bit hit-and-miss. I have one phone that never connects, one that rarely connects, and one that seems to work pretty much every time (I still have to do the 'unplug/replug/restart' shuffle from time to time)
I would suggest investigating WiFi ADB. If it works with your device (not all devices support it) then it'll save you a lot of time in the long term:
Install one of the various WiFi debug apps from the market
Run it and note the IP address and port it gives you
Navigate to where your android sdk platfrom tools are installed (a default Windows install should be C:\Android\sdk\platform-tools
Type adb connect [ipaddress]:[portno] (ex adb connect 192.168.1.100:5555)
If your device supports wifi debugging, it should show up in Eclipse within a couple of seconds, and you never need to do the plug in/unplug/restart shuffle again!
You don't need any third-party application. See this answer and set-up WiFi debugging with ADB.
EDIT:
You don't need root also.
Check my answer here: You should install the correct drivers its really easy by following the steps from the video
Hope that helps! :)

Categories

Resources