Debugging an android app thats working with serial ports - java

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.

Related

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?

Question about connecting an external mobile to Android Studio

I just started programming Java. In the Android Studio app, when I connect my mobile phone and write Java code, when I select the build option, I don't see any changes in the phone screen. I don't know what to do now.I activated both the developer option button and the USB debugging button.Please help me
In Android Studio use the Connection Assistant to troubleshoot your device connection. Also, check your USB cable and port on your PC.

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

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.

Debugging app from the device without USB and WIFI

Since my app runs on the emulator and crashes on my device. I would like to see log report of my app directly from the device. So that it might lead to better way of debugging. But I have following problems
My device is connected to the PC via LAN.
My device doesn't have USB connection (no slave port).
I am using android studio as IDE. I have seen couple of examples which could be used if the device is connected to same wifi network like Debugging over wifi network but this doesn't help.
There is an official documentation with wifi official documentation for wifi still it needs USB connection in step 3.
Does Android Studio provide any type of solution?
if your app is firebase configured maybe you can use DebugView from firebase site.
To get the crash reports from any android device you can use crashlytics..
This is very nice library which provides you very details logs of crash along with many other details like android device name, ram size, memory, orientation etc..
Good thing is that this crashlytics was different library previously, which is now part of Firebase .
To get started you can know about crashlytics from here you can follow the documentation from here
Actually, firebase helps you get the crashlytics. The error message will be stated in the dashboard once the app crashes. This is a life saver but I found out that, we can simply connect the device to IDE without USB. Just the PC and your device should be connected via LAN
Using ADB tool. Run the adb.exe file as admin. Connect using tcp. Just address and Port is necessary.
You can simply debug from the IDE, In my case android studio.

Android USB application

I have a have been doing my research on a program in which an android application makes a communication with a Desktop computer through a USB connection. I did find out that Android 3.1 allows USB communication, but I have no idea how to proceed on it. I'd be very helpful if someone could tell me how this is done.
Thanks
Nik
You can use this API.
Accessory Development Kit
More detailed information can be had from this link as well.
Android apps, communicating with a device plugged in the USB port
I am not sure you can test this using an emulator.So develop an application and deploy it in a real device and connect that device to your PC via USB port for testing.

Categories

Resources