简体   繁体   English

如何在Android Studio上调试预建共享库?

[英]How to debug prebuild shared library on Android Studio?

I compile a project using prebuild shared libraries (compiled elsewhere), that I want to debug in Android Studio. 我使用prebuild共享库(在别处编译)编译一个项目,我想在Android Studio中调试。

I tried to copy the library source code into my Android Studio project, and use them to make breakpoints, but it's not working. 我试图将库源代码复制到我的Android Studio项目中,并使用它们来创建断点,但它不起作用。 It cannot find the position to put it (pending breakpoint). 它无法找到放置它的位置(挂起断点)。 The prebuild libraries are well debugging compiled, but elsewhere. prebuild库很好地编译,但在其他地方。

How can I include library source files into my android studio project, and used them to debug my prebuild libraries during application execution? 如何将库源文件包含到我的android studio项目中,并在应用程序执行期间使用它们来调试我的预构建库?

The prerequisite is to declare the following in your gradle file: 先决条件是在gradle文件中声明以下内容:

buildTypes {
    debug {
        minifyEnabled false
        debuggable true
    }
}

Then you need to edit your run configuration: 然后,您需要编辑运行配置: 在此输入图像描述 Select the debug type as dual and add the missing symbol directories by pressing the plus button. 选择调试类型为dual,然后按加号按钮添加缺少的符号目录。

Make sure that you have selected the debug Build Variant in Android Studio. 确保您已在Android Studio中选择了调试Build Variant。 Sometimes it helps if you run "Clean Project" and "Refresh Linked C++ Projects" and then make a full rebuild. 有时,如果您运行“清理项目”和“刷新链接的C ++项目”,然后进行完全重建,它会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM