斯卡拉+安卓:是否有人成功地构建和调试在Eclipse?斯卡、Eclipse

2023-09-06 00:16:05 作者:Qqwmly.com

到目前为止,我已经能够在Eclipse调试的唯一方法是使用Treeshaker使用Scala IDE的越野车2.8分支。如果我尝试建立使用Scala IDE不Treeshaker,我每次拿到的这个长螺纹在斯卡拉-上的机器人。

So far, the only way I've been able to debug within Eclipse is to use Treeshaker with Scala IDE's buggy 2.8 branch. If I try to build with Scala IDE without Treeshaker, I get ClassNotFound errors per this long thread on scala-on-android.

在理想情况下我会与建立在Eclipse SBT-Android和调试,但我一直无法成功地这样做。到调试SBT-Android项目,我能够实现最接近的是建立SBT-Android项目的Andr​​oid:包调试命令,用android启动可执行:启动模拟器的命令,然后连接DDMS应用程序的主题。

Ideally I would build with sbt-android and debug within Eclipse, but I've been unable to do so successfully. The closest to debugging an sbt-android project I was able to achieve was to build the sbt-android project with the android:package-debug command, start the executable with the android:start-emulator command, and then connect DDMS to the application's thread.

不过,我有断点设置,只有将执行后,我连调试器线程,和他们没有造成到达时,线程停止。

However, I had breakpoints set that only would have executed after I connected the debugger to the thread, and none of them caused the thread to stop when reached.

有没有人能够使用任何其他工具,除了Treeshaker基于斯卡拉2.8的Scala IDE Eclipse中调试斯卡拉的Andr​​oid code?

Has anyone been able to debug Scala Android code in Eclipse using any other tools besides Treeshaker with Scala IDE based on Scala 2.8?

更新:从与SBT,sbteclipse,和android-插件命令行建成后,我成功地调试(未建)在Eclipse

UPDATE: I'm successfully debugging (not building) in Eclipse after building from the command line with sbt, sbteclipse, and android-plugin.

我所做的就是使用Eclipse的新的Andr​​oid项目菜单,连接到现有的源,并将其指向./src/main目录。然后Eclipse中所承认的Andr​​oid设置,并DDMS识别任务为属于在Eclipse Android项目

What I did was to use Eclipse's new Android project menu, connect to existing source, and point it to the ./src/main directory. Then Eclipse recognized the Android settings, and DDMS recognized the task as belonging to the Eclipse Android project.

我也不得不从构建路径中删除src文件夹并添加./scala文件夹重新配置Eclipse项目的Java构建路径源文件夹。然后,我不得不重新启动Eclipse来断点添加到斯卡拉文件。

I also had to reconfigure the Eclipse project's Java build path source folders by removing the src folder from the build path and adding the ./scala folder. Then I had to restart Eclipse to add breakpoints to the Scala file.

下面是一些有趣的讨论的困难构建和调试使用Eclipse的Andr​​oid应用程序。

Here's some interesting discussion about the difficulties building and debugging Android applications using Eclipse.

推荐答案

在Android上运行的常规调试斯卡拉code。使用Eclipse的运作良好,并表现或多或少像普通(非Android)应用程序调试斯卡拉。

In general debugging Scala code running on Android using Eclipse works well and behaves more or less like debugging Scala on regular (non-Android) applications.

我用SBT与SBT-Android和机器人:启动模拟器或Android:启动设备

I use sbt with sbt-android and android:start-emulator or android:start-device.

根据是否我需要调试应用程序启动时,我将等待在设备或模拟器上的开发者设置调试器的选项。要做到这一点,运行DevTools/开发设置。选择您的应用程序,并检查等待调试器。

Depending on whether I need to debug the application startup, I set the option to wait for the debugger in the developer settings on the device or emulator. To do this, run "DevTools" / "Development Settings". Select your application and check "Wait for Debugger".

然后,你必须选择的过程中DDMS调试。确保调试端口被示出,然后与Eclipse调试器连接

Then you have to select the process to debug in DDMS. Make sure the debug port is shown, and then connect with the Eclipse debugger.

调试器未安装断点的可能原因是源$ C ​​$ C线没有直接等同于字节code。对于COM prehensions浮现在脑海中。

A potential cause for the debugger not installing the breakpoints is that the source code line has no direct equivalent in byte code. For comprehensions come to mind.