如何在Android Studio中调试Android库模块? [英] How to debug android library module in Android Studio?

查看:108
本文介绍了如何在Android Studio中调试Android库模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android Studio项目,其中包含一个库模块,该模块作为另一个gradle项目添加到了其中.我想调试库代码并在其上设置断点.

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.

如果要在模拟器或真实设备上运行应用程序时调试库模块,应该使用哪些gradle设置?

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

更新1

这是settings.gradle文件:

this is the settings.gradle file :

include ':app'
include':my-library'

推荐答案

几天后,我找到了能够调试库模块的正确配置:

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

1- 创建一个项目,该项目由两个模块组成:应用库模块

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

2- 直接模块依赖性从 library-module 添加到 app .这就是 app 的build.gradle:

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

compile project(':library-module')

3- 删除 app build.gradle

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

4- 从应用和库模块

minifyEnabled true
shrinkResources true

这篇关于如何在Android Studio中调试Android库模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆