简体   繁体   English

在Android中调试外部库

[英]Debugging external libs in Android

I have several .jar files I want to reference into my Android project, and I have the sources for them. 我有几个要引用到我的Android项目中的.jar文件,并且我有它们的来源。 The point is that in order to build .jar 's from sources, I have to use Maven - the build process is pretty complicated, and as I am new to both Android and Maven, I am trying to reuse the script for building these libraries that was written before me, and do not add the sources directly. 关键是,为了从源代码构建.jar ,我必须使用Maven-构建过程非常复杂,并且由于我是Android和Maven的新手,我试图重用脚本来构建这些库那是在我之前写的,不要直接添加源。

So my intentions were pretty simple: 所以我的意图很简单:

  1. Build the .class files via Maven script 通过Maven脚本构建.class文件
  2. Compile .jar from these .class files via jar tool in the command line 通过命令行中的jar工具从这些.class文件中编译.jar
  3. Reference these libraries from my android project. 从我的android项目中引用这些库。

But as soon as I copy .jar files to the libs folder in the android project - I cannot add sources on them - and I cannot debug those. 但是,一旦我将.jar文件复制到android项目中的libs文件夹中-我无法在其上添加源代码-并且无法调试它们。

Looks like this issue has been several times on SO here or here . 看起来这个问题在这里这里已经有好几次 Still nothing works for me. 仍然没有什么适合我。 .properties file doesn't seem to be recognized by Eclipse, when I go to Java Build Path - the path to the sources is marked as (None) and it is not modifiable, and if I reference the libraries like it was before ADT17 (adding a custom directory like lib with no s in the end, and referencing these jars as external libraries) - this fixes the debugging, but the compiler doesn't seem to include all the source code due to this 当我转到Java Build Path时,Eclipse似乎无法识别.properties文件-到源的路径被标记为(None)且不可修改,并且如果我引用的库类似于ADT17之前的库(最后添加一个自定义目录(如lib ,不带s ,并将这些jar引用为外部库)-这可以修复调试问题,但由于原因,编译器似乎并未包含所有源代码

I've read that should be fixed in ADT20, but I am using ADT21 and still no luck. 我读过应该在ADT20中修复的问题,但是我使用的是ADT21,仍然没有运气。 Any usable workaround of this? 有任何可行的解决方法吗?

Finally did it! 终于做到了! That still looks like a bug in ADT. 看起来仍然像是ADT中的错误。 The only solution I found is to reference the libs as it was before ADT17 (put them into the separate lib folder without 's', add them to build path, and mark the checkboxes in the Configure Build Path -> Order and Export ). 我发现的唯一解决方案是引用ADT17之前的库(将它们放入不带's'的单独的lib文件夹中,将它们添加到构建路径中,并在Configure Build Path -> Order and Export标记复选框)。

The thing I was missing is actually marking the checkboxes - for some reason when you change anything in that dialog, the checkboxes are becoming unmarked. 我所缺少的实际上是标记复选框-出于某种原因,当您在该对话框中更改任何内容时,这些复选框都将变为未标记状态。 I guess I just didn't notice that... 我想我只是没有注意到...

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

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