2

When you have issues with android source code, how do you dig into the code? For example for this issue
I saw from the debugger that the CookieManager is AwCookieManager.
So from Google search I found that the setCookie is the following:

public void setCookie(final String url, final String value) {  
        nativeSetCookie(url, value);     
}  

But I had trouble finding that native code to see what's going on.
I searched again in Google and found different version of this native and java and ended up with this file: https://android.googlesource.com/platform/external/webkit/+/4bcd50196a7fe4c0c909ce6a7cfac6a808336611/Source/WebKit/android/jni/CookieManager.cpp

but I am not sure if this is the right file to look at and I suspect there is a smarter way for debugging these kind of things. I also wasn't sure how to find the called methods from that file.

So how do you do it?

Jim
  • 3,845
  • 3
  • 22
  • 47
  • The official guide has a [whole section](https://developer.android.com/studio/debug/) on debugging Android applications. It might be worth being more specific on what you wish to achieve. Have you tried using a debugger tool? Is it really of your interest to inspect the native library's source code? – E_net4 Jan 14 '19 at 10:48
  • @E_net4wisheshappyholidays: Yes it is of interest since I don't understand why the code does not work. I would like to inspect the actual logic. Debugger in Android Studio does not take into native code – Jim Jan 14 '19 at 12:24
  • Possible duplicate of [How to get NDK debugging to work in Android Studio?](https://stackoverflow.com/questions/32413593/how-to-get-ndk-debugging-to-work-in-android-studio) – Martin Zeitler Mar 05 '19 at 03:31
  • you just have to run `make idegen && development/tools/idegen/idegen.sh` from the root directory of the sources to use Android Studio. dual debugger is way more convenient that using two independent debuggers. – Martin Zeitler Mar 05 '19 at 03:35

1 Answers1

0

For java code debugging, use Java remote debug, check this

For C++ code debugging, use GDB remote debug, check this