Connecting Android studio to raspberry pi +touch screen dispaly(Android things) - java

I am doing a project using Android things,I have downloaded image and flashed in memory card ,n I got Android things os screen.... Until this is all fine..
Now I want develop app..how to connect to raspberry pi from Android studio so that the device should visible in deployment target of Android studio...so that I can debug ,put break point n see logcat...etc..I am using WINDOWS 7 OS For development system...I have installed Google USB driver from sdk manager,puTTy I have downloaded serial debug IP configuration did,..now adb is not detecting raspberry pi 3 .....but if I connect my mobile phone I can easily see the device in deployment target of Android studio....I have ref many sites ... But not working....if anybody have worked on Android thing with Windows Os plz provide me a full solutions right from scratch....n also suggest me site and books for Android things

The USB port of the Raspberry Pi is for charging only, it does not support data transmissions. You need to use adb over the network (either WiFi or wired).
First make sure to get the Raspberry Pi on the same network as your laptop. If you have access to a screen, you should also be able to see the IP under settings.
Once you know that, you can just use:
adb connect [Raspberry Pi]
And then you will be able to use it from Android Studio.
In theory you can also use:
adb connect Android.local
But that will not work if you have more than one android device on your network.

You cannot use the USB port from the Raspberry Pi for debugging. You need to connect its Ethernet port to your computer and debug over Ethernet.
See Android Things on Raspberry Pi.

Related

Android app ignore Raspberry PI Wifi AP.How to connect Android App to non internet Wifi network?

I have basic web view android app - client side, and Raspberry Pi as server side (NodeJS WEB server). Raspberry acts as Wifi access point and receive connections. Android app works when i have internet enabled on raspberry via lan port. When i try to connect and around me i have saved wifi connection wit INTERNET ACCESSS, app ignore raspberry pi wifi. How to force android app to connect to NON INTERNET WIFI and keep the connection?
I assume you want to know, how you can prevent Android from switching networks, when the OS detects no Internet Connection.
You could start by disabling the Google Connectivity Services App. This sometimes works for me. To do this go to Settings -> Apps -> Google Connectivity Services (On some phones you need to enable 'system apps')
This feature might have different names on some brands...

Does Android Studio only accept phones that are 11+?

I'm trying to launch a test ad on Android Studio so that I can put interstitial ads on my app, but when I try launching the application on my connected device it opens for a split second before crashing. I understand that to connect you device via wifi your phone must be Android 11+, mine is the 9th version but I'm connecting it through a USB cable and it doesn't seem to mention any requirements for this method of connection. Wondering whether my Samsung phones version of Android is the root of the problem or whether it's just an error in my the code.
I'm actively using Android Studio with my Android 10 phone and I can confirm it works flawlessly, so probably your issue has something to do with your setup.
Are you using the provided ADB in Android Studio or have you installed it separately?
Did you enable USB debugging on your phone?
Does "adb connect" work when you exec it directly from the command line?

Debugging an android app thats working with serial ports

I am developing an android app to communicate to a drone using MAVLINK. I am using UsbSerial by felHR85 and dronefleet libraries for this. After building and installing the app, I use my phone as an Android USB host and connect a PixHawk microcontroller to it.
When I run the app on my phone with PixHawk attached, I have no method to know why my app crashes (if it does crash). I just get the "App keeps stopping" error message. I cannot view the log messages via Logcat since I'm not connected to my PC. The serial port library developer has given the idea of debugging over WiFi but I do majority of my work in my office where I use Ethernet LAN, not WiFi.
Without the app crash stacktrace, I cannot move further. So how do I debug my app, specifically app crashes?
Details:
Android Studio Arctic Fox
Ubuntu 18 LTS
Java programming language
Samsung android phone with Android 11
I'm also developing an app that acts as a USB Host to an Arduino board.
For debug, I'm using Logcat app (https://play.google.com/store/apps/details?id=com.tananaev.logcat&hl=en&gl=US). This allows you to view the Logcat logs on your Android phone.
You need to follow the directions in the app description:
Connect your phone via USB cable and run following adb command:
adb tcpip 5555
Disconnect USB cable before trying to use the app.
You can filter the logcat results by keyword or tag, and/or search for a keyword. I've found it very useful.
If this doesn't work for you, I've seen that there are other similar apps that you can try.

Connect Raspberry Pi to Android device via bluetooth

I just started of using raspberry Pi 3(Model B). I want to establish a bluetooth connection between raspberry pi and android device. Manually I am able to do a connection with android device but I want to run a program(python or any other language) so when I run it search the nearby device and connect with some specific device. How I achieve this? If any one have program similar like this then it is very helpful for me. I want to do code on Raspberry Pi which connect with diffrent device and collect the data.
Thanks in Advance.

Connect ADB over wifi

Is there any way to connect adb over wifi with my android phone. I don't have any USB cable, as there is way to do this like here:- link
But for doing this i need to connect my phone to pc with USB first but my mobile has some problem it was not connecting to my pc with USB so any way to do it without using usb.
you either need to have a device connected or a running emulator for using following command:
adb tcpip 5555
what if you don't have usb cable for some reason?
what to do?
here's a solution.
If you run an android emulator, above command will work but draw back is , it take too much time (few minutes to be specific).
So what's the fastest solution,
Well, install AnBox.
Its also an emulator which opens much faster, within few seconds.
now, you can run above command:
adb tcpip 5555
to start adb in tcpip mode
use below command to connect to your android phone over wifi
adb connect <ip address of android phone>:5555
if you want to control it over wifi from laptop use scrcpy
scrcpy -s <ip address of android phone>:5555
With the launch of Android Studio Bumblebee (2021.1.1), a new feature ADB over Wi-Fi is included, to simplify flow to connect to your Android 11 and higher devices over Wi-Fi for deployment and debugging using ADB. After you enable debugging over Wi-Fi on your device, select the Pair using Wi-Fi action in the Physical tab of the new Device Manager to open the pairing wizard. Then follow the steps provided to pair to a device connected over the same network.
To learn more.
Yes you can. But to do this you need a rooted android device. After that simply download Wifi adb from google play store. Link given below
https://play.google.com/store/apps/details?id=com.ttxapps.wifiadb&hl=en
Then go to your sdk folder/platform tools in the command prompt. Then type adb connect 192.168.xx.xx:xxxx , where xx is the no. shown in the Wifi ADB app. That's it. We also use it as Most of the times USB cables get worn after some usage.
make sure you have installing your device driver and adb service and
1- is activated USB debugging in android device
setting -> (system)-> developer options -> USB debugging and must be could to see your device when you connected by USB port ( by this command : adb devices)
so when you connected by USB follow this Commands :
2- in some android versions need to select Transfer File option in the Use USB To from Connected devices
1-stay connect via USB
2-connect to your WIFI network (computer and mobile device both)
3-ping DeviceIP (must be have ping to your device)
4 - adb kill-server
5 - adb usb
6 - adb tcpip 5556 (if you are using docker container it may need different port number like 5037)
7 - adb connect "yourDeviceIP:5556"
8 - devices (must be see two device names , one of them is by deviceIP:5556)
9-unplug USB cable
then it's Done! and you could to test your app
ref: JDev answer

Categories

Resources