简体   繁体   English

如何在Android Studio中为预构建库设置本地cpp源路径

[英]How to set the local cpp source path in Android studio for prebuild library

I created an App which includes our source code as a native lib (so-file). 我创建了一个应用程序,其中包含源代码作为本机lib(so-file)。 I'm able to step into it and everything works fine so far with this code. 我能够介入其中,到目前为止,使用此代码可以正常工作。

This native lib links against another native lib which was pre-build on a different machine and which I copied into the jni-abi-folder. 这个本机库链接到另一个本机库,该本机库是在另一台计算机上预先构建的,并且我将其复制到jni-abi-folder中。 I have checked out the svn-repository of this so-file in a different folder parallel to my project and need to be able to debug also into it. 我已经在与我的项目平行的另一个文件夹中检出了该so-file的svn存储库,并且需要能够对其进行调试。

When I now do a break, I can see the method names in the callstack so I assume that the symbols can be loaded, but Android Studio doesn't know where to find the source files. 当我现在休息时,我可以在调用堆栈中看到方法名称,因此我假设可以加载符号,但是Android Studio不知道在哪里可以找到源文件。

Under Visual Studio, when I did a break, I could specify the symbols in the symbol path and then an error was displaced that I should navigate to the corresponding source file. 在Visual Studio中,当我休息时,可以在符号路径中指定符号,然后替换错误,我应该导航到相应的源文件。 Then I only needed to navigate to the folder and it was working. 然后,我只需要导航到该文件夹​​即可。

How can this be done with Android Studio - I have the newest version 3.2.1 installed. 如何使用Android Studio做到这一点-我安装了最新的3.2.1版本。

I finally found the solution. 我终于找到了解决方案。

  1. I got a stripped version from my colleague, he basically gave me the version inside his apk which is stripped. 我从同事那里得到了一个剥离的版本,他基本上是在他的apk内将剥离的版本给了我。 Now he gave me directly the build version (I think it is located somewhere in the intermediate directory or so, just search for the name of the lib). 现在,他直接给了我构建版本(我认为它位于中间目录中的某个位置,只需搜索lib的名称)。
  2. Under Run\\Edit Configurations\\Debugger\\LLDB startup commands the original source directory can be mapped to the source directory on my computer which is different. 在“运行\\编辑配置\\调试器\\ LLDB启动”命令下,原始源目录可以映射到计算机上的源目录,这是不同的。 To achieve this, enter "settings set target.source-map or-dir cur-dir" 为此,请输入“ settings set target.source-map or-dir cur-dir”

There should be a way to find out the original source directory from the so file, but I don't know it right now. 应该有一种方法可以从so文件中找到原始源目录,但是我现在不知道。

I hope this can help somebody else 我希望这可以帮助其他人

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

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