I've been searching for trying to find an answer to this question.
I have already installed valgrind on android phone as below step.
==================================================================
The valgrind is already in the ICS 4.0.3
The steps to enable the valgrind when building the ICS.
Step 1:
Modify the file ./build/target/product/core.mk as following.
sensorservice
+ valgrind
wpa_supplicant.conf
Step 2:
build the ICS.
from [https://wiki.linaro.org/Platform/Android/UseValgrindOnAndroid]
==================================================================
Is this right one??
Anyway.. I'm also searching my question in here & find this answer.
==================================================================
You can try to clear the logcat first
prompt# adb logcat -c
prompt# adb logcat
You should be able to see the logs coming in once you triggered your application.
am start -a android.intent.action.MAIN -n com.example.hellojni/.HelloJni
I had problems with my shell script and i used this instead.
adb shell setprop wrap.com.example.hellojni "logwrapper /data/local/Inst/bin/valgrind"
==================================================================
But, my android phone does not work.. at first step.
'prompt# adb logcat -c' make a 'waiting a target..' very very long long time...
How do I start an Android app with valgrind?
Related
I am trying to debug a Yocto project. I have flashed cpp binaries on some device.
Now I my trying to display logs using below adb command
adb shell tail -f /var/log/acs_main.log
The problem i'm facing is that logs are not displayed continuously.I have to cancel and again start to print further log statements.
Anyone can help me in this ?
I have a strange problem after Oreo update - 'adb logcat' stopped working.
Note that device is properly connected - I can debug, I can view logs in Android Studio, even I can start adb shell and do logcat but no direct logcat out from the adb command.
So in short,
# adb logcat
Absolutely no output. However, following works (logcat from the adb shell)
# adb shell
logcat
Any idea?
try these steps (even though your logcat is open)
in android studio go to
View->Tool Windows->Logcat
see if it works
As per posted in https://developer.android.com/training/app-indexing/deep-linking.html, we could start the deeplink App Launch using the below command
adb shell am start -W -a android.intent.action.VIEW -d "example://gizmos" com.example.android
But if I want to start debugging, I could add a -D, as below
adb shell am start -W -a android.intent.action.VIEW -d "example://gizmos" com.example.android -D
My App got launched, but it is there stating
Waiting For Debugger
Application Android System (process system:ui) is waiting for the debugger to attach
From there, I check my Android Studio, it is not attached. Wonder how could I get it attached?
there is a great article and a great comment under it.
Briefly:
1. Before the line you want to debug put Debug.waitForDebugger().
2. Put breakpoint where you need it.
3. Run application (from deeplink, in this case).
4. You will see it's frozen.
5. In Android Studio attach debugger to process.
6. Voila! Now you have debugger activated on that breakpoint.
In this way I was able to debug deeplinks.
You'd either have to manually attach it after launching, or already have the app running and attached then launch your deeplink. There's no way for the phone to know it needs to attach to a debugger on a connected PC when it launches an app.
I've been trying to install Vending.apk into my emulator w/o success. It says it already exists and fails to replace it when I use adb install -r. The icon does not show up on the screen so I can't tap it to launch the Google Play marketplace.
Therefore, I thought I could run it from my PC (MacOSX) using adb like this:
adb shell am start -a android.intent.action.MAIN -n com.android.vending/.Vending
I constructed the above from examples that work in this article:
How to run (not only install) an android application using .apk file?
And I unzipped the AndroidManifest.xml file using info from this method to see if I could discover the activity name, but no luck:
aapt dump xmltree <apk-file> AndroidManifest.xml
I guess I need to know the exact command to execute the vending apk because I can't seem to find the correct Activity class. adb shell am start keeps giving me error type 3, Activity class does not exist.
Thanks
You can try this:
adb shell am start -n com.android.vending/com.google.android.finsky.activities.MainActivity
I've been searching for the last week trying to find an answer to this question.
How do I start an Android app with valgrind? I know I can start an app with the 'am' command, but it starts the app and exits.
I'm writing an app that uses the NDK for native C code, and I need to check it for suspected memory errors.
Edit:
I've learned a little more. You can "wrap" an app with a shell script.
Here's the shell script I'm using:
#!/system/bin/sh
VGPARAMS='--error-limit=no'
export TMPDIR=/data/data/com.starlon.froyvisuals
exec /data/local/Inst/bin/valgrind $VGPARAMS $*
And here's setprop:
adb shell setprop wrap.com.starlon.froyvisuals "logwrapper valgrind"
And here's how I start the app:
adb shell am start -n com.starlon.froyvisuals/.FroyVisuals
I don't think this is right, because I'm not sure where the shell script fits in and I'm not seeing anything in logcat. Any hints?
Edit2:
Oh the shell script is indicated with "setprop" command above. So
adb shell setprop wrap.com.starlon.froyvisuals "logwrapper /data/local/val.sh"
I'm still not seeing anything in logcat.
You can try to clear the logcat first
prompt# adb logcat -c
prompt# adb logcat
You should be able to see the logs coming in once you triggered your application.
am start -a android.intent.action.MAIN -n com.example.hellojni/.HelloJni
I had problems with my shell script and i used this instead.
adb shell setprop wrap.com.example.hellojni "logwrapper /data/local/Inst/bin/valgrind"
You should be able to pass in the parameter right after valgrind
I encountered this problem too. In my situation, I edit the "val.sh" in windows & adb push it to the emulator, but the shell script could not be executed correctly. Then I use a echo "*" > val.sh style to make the "val.sh" and It works well.
So you should first make sure the "val.sh" could be interpreted correctly.