How to debug android library module in Android Studio?

后端 未结 4 1835
离开以前
离开以前 2021-02-08 03:48

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 i

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-08 04:18

    I'm using this setup to debug my libraries:

    |- myApplication
    |  |- settigs.gradle
    |  |- build.gradle
    |     ...
    |- myLibrary
       |- build.gradle
          ...
    

    add to settings.gradle:

    include ':myLibrary'
    project(':myLibrary').projectDir = new File(settingsDir, '../myLibrary')
    

    add to build.gradle (of your app)

    compile project(':myLibrary')
    

    Your library gets simply included and you can debug and set breakpoints just like in the app.

提交回复
热议问题