How to debug android library module in Android Studio?

Farhad Faghihi :

I have an Android Studio project which contains a library module, which is added as another gradle project to it. I would like to debug the library code and set breakpoints on it.

What gradle settings should I use, if I want to debug a library module while running the app on emulator or real device ?


Update 1

this is the settings.gradle file :

include ':app'
include':my-library'
Farhad Faghihi :

After a few days struggling I found the right configuration for being able to debug the library module :

1- Create a project which consists of two modules, the app and the library-module

2- Add direct module dependency to app , from the library-module. This is what the app's build.gradle :

compile project(':library-module')

3- Remove any automatic signing configuration added in the app build.gradle

4- Remove these lines from both the app and library-module

minifyEnabled true
shrinkResources true

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=456696&siteId=1