How to view Gstreamer log in Android? - android

How to view the output of log functions like GST_CAT_INFO, GST_DEBUG etc in Android environment? Can I view them in logcat?

The log is written to stderr. You can redirect it to a file (2>debug.log) and download it to your computer. There you can just read it using 'less' or 'more'. Alternatively disable the ansi colors (GST_DEBUG_NO_COLOR=1) and use gst-debug-viewer to interactively browse it.

There is a method to redirect stdio to the log so it is visible in logcat:
Redirect stdout to logcat in Android NDK
I have used this several times. I also remount /system read-write on android and edit "/system/build.prop" to add the setting so it survives a reboot. On development platforms, you can even use "vi" within adb shell to edit the file.

Related

adb uiautomator can't access XML elements on WebView apps

I'm using this command for getting UI Elements/XML of Apps based on WebView. In this case, I'm using the UPS app from the Play Store. This app is WebView based. Right now my device its using
"Android System WebView (Chromium) 99.0" i also tried "Bromite System WebView" but without success.
Sometimes, the dump actually work and I get the UI Elements and the xml file, but in some cases the xml file is empty, giving me nothing.
Command:
adb shell uiautomator dump /sdcard/file.xml

Ui automator viewer--> Device screenshot, Reason : Error while creating temporary file to save snapshot : null

When I click on Ui automator viewer after connecting my mobile device--> Device screenshot throws error
Error :
Error obtaining UI hierarchy Reason : Error while creating temporary file to save snapshot : null
Please let me know how to fix this issue?. Thanks
Download an old version of platform tools from Google
copy adb.exe and replace with current one in your SDK tools.
Source: https://softwaretestingboard.com/q2a/1654/appium-automator-viewer-could-android-emulators-screenshot#ixzz5qS8ez6GY
As I believe this app is not allow you to take screen shot from your device and from uiautomator as well.
As I am also getting same error but when I used to get the screenshot of other app it works fine but in the case of my app its not allowed to take screen shot using uiautomator.
So better way for now to get allow it by developer in test version of app so it works to get the element of app screens.
Take the screenshot and dump manually and open from "uiautomator". It will work. Use below commands to create and pull the dump from device:
-> adb shell uiautomator dump
-> adb pull /sdcard/window_dump.xml
Go to Ui automator, then select open file, select screenshot and corresponding dump xml file. Now we can see all the elements in UiAutomator tool.
Note: If you are using Mac-OS file should be window_dump.uix
There are two solutions :
1. Disconnect your device and reconnect. It should work.
OR
2. Kill all instances of adb.exe from task manager And restart UIAutomator. It should work.
I am taking those viewer using command prompt:
adb shell uiauomator dump
adb pull /sdcard/windows_dump.xml
reading those id manually

View SQLite database on Nexus 4?

I am attempting to view a database for an app I am developing, I attempted to access it via the shell, however, it seems that in my Nexus 4's 'System/xBin' folder there is no 'sqlite3' file, and therefore unable to query my database to see its contents. Is there anyway I can do this? I am aware of an Eclipse plugin, but I am using Android Studio.
For example:
>adb -s DEVICE shell
>cd data/data/PROJECT/databases
>sqlite3 mydatabase.db
>sqlite3 not found
Thanks!
Can you see the database in the emulator ?? If yes, then probably you will not be able to see the database on the device unless you are using a device which is rooted. You will able to query the database though, but you will not be able to see it through file browser in ddms or through this command. First, please check if you can see it on emulator or not.

Can I use the ADB to see if my application is successfully writing to a text file?

My application stores data by writing it to a text file, however when I try to open and read the text file the program doesn't recognize that I've written anything in the text file.
I've decided to try to use the adb to see if I can find the txt file, but when I go to data.app and I try to open my file - com.benbaltes.Android-Fields2.apk it says it can't cd to that app.
Is there anyway I can check and poke around the files in my app? I am rooted and have SU access
It depends on how you create the text file, but you can definitely poke around. Take a look inside /data/app-private or /data/data/your_package_name/. You can use adb shell to start a shell on the device/emulator, and cat works to print a text file (any file, actually) to the console.
The apk file is not where any data is written -- that's the distribution file for your app.

How to test the performance of an Android application?

How can I test an application for performance in Android? What is the support provided in Android and how do I use it?
If you want to profile your application to find performance bottlenecks you can use the traceview tool. This gives you a graphical view of performance traces of your application.
To create a trace add the following to your code where you want to start tracing:
Debug.startMethodTracing("myapp");
and then put the following when you want to stop tracing:
Debug.stopMethodTracing();
This will create a trace file call myapp.trace in the root directory of the SD Card. As it is written to the SD Card:
If you're using the emulator you'll need to add an SD card to your AVD.
You'll need to give you app permission to write the SD card by adding the following to your Manifest:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Once the file has been created you'll need to copy it to your PC. You can do this using the adb command:
adb pull /sdcard/myapp.trace c:/my/dir/myapp.trace
Finally, start traceview giving it the full path to the trace file:
traceview c:/my/dir/myapp.trace
I did have some problems with traceview failing with OutOfMemory exceptions. I fixed this on Windows by changing the last line of traceview.bat from:
call java -Djava.ext.dirs=%javaextdirs% -Dcom.android.traceview.toolsdir= -jar %jarpath% %*
to:
call java -Xmx1g -Djava.ext.dirs=%javaextdirs% -Dcom.android.traceview.toolsdir= -jar %jarpath% %*
Adding the -Xmx1g option allows traceview to use more memory.
Also, theoretically, DDMS can get memory allocations for your program and then you can analyze the dump using profilers.
DDMS Reference.
The reason why I have theoretically in italics is that I myself have not tried doing anything such, yet.
I think traceView contains too much information, you can easily get lost.
My solution is just log the system time at three place in the code.
Before and after and center at the potiential slow code.
like binary search, next time, narrow it down step by step, then finally find the culprit code.
Another way to test is Using TruClient on Load Runner
Steps to be followed for Mobile Web are:
New VuGen Script
Mobile Protocol
Select TruClient Mobile Web
Click Create
Now you can generate scripts
Click Develop Script button
PoP up window appears to select the device
Select Actions and you can record the scripts
Steps to be followed for Native Mobile are:
New VuGen Script
Mobile Protocol
Select TruClient Native Mobile
Click Create
Now you can generate scripts
click develop script
TruClient window that plugged with Firefox appears
Click General Settings
Configure the SERVER URL PORT
If u don't know the server url port means install OS MONITOR application on your device. here you can find the ip address
Enter User Name and Password
Click done
you can record the scripts and perform your testing....
you can use load runner.,
use this link to find more about it.,
http://www.perftesting.co.uk/recording-and-performance-testing-android-applications-with-hp-loadrunner-vugen/2011/11/14/
Steps to be followed are:
Create New VuGen Script
Select Mobile Application-HTTP/HTML
Recording Options--> Select Record Emulator
Give the path to Record Emulator as D:\android\AVD Manager.exe
In the command line
-avd AVD_NAME -netspeed full -netdelay none
where AVD_Name is the name of your Device
select the working directory
click finish
Now you can perform your test.,

Categories

Resources