Search code examples
androidandroid-studiointellij-ideagradleandroid-studio-2.1

How to make debugging work in Android Library projects?


I have an android project consisting of multiple subprojects and one of those subprojects is network, the problem is debugging breakpoints doesn't work in the network library project and also Android.Util.Log doesn't work too, so i don't have any way to debug the project right now and that's really makes things tough while fixing some issues or adding new functionality in the project. On a breakpoint it says

no executable code at line 42

also when i load the project (the one containing all the other projects in android studio) it says can't load 3 modules fine, but they work when i run them. Just wanted to know if anyone else is facing the problem and what could be the solution.

I have tried putting the .iml files in .idea/modules/network and it helps me get rid of the error of can't load modules. I've tried cleaning the project already and rebuilding it. Restarting android studio, upgrading android studio I am on the latest version of android studio now.

When i open the project in intellij idea ultimate it gives me message that unsupported projects, can't have java projects with gradle projects in android. But the projects i have are Andriod library projects with their own build.gradle files.


Solution

  • It sounds to me like what's happening is your application is being built with older compiled versions of the libraries. How are they included in the project, gradle dependencies?

    To get logging in you would need to open the modules add the logging and re-build them.

    Copying around .iml is not a good idea in general. The correct process is to do an import in Android Studio. Here is a pretty good tutorial http://www.truiton.com/2015/02/android-studio-add-library-project/

    The last step about adding it to your gradle file to compile is important that is was will allow it to pick up changes, like adding logging.