gpt4 book ai didi

java - sbt:对象应用程序不是包的成员

转载 作者:太空狗 更新时间:2023-10-29 12:54:59 25 4
gpt4 key购买 nike

我从 sbt android plugin 成功构建了仅限 Scala 的项目模板.接下来,我尝试将一些 Java 源代码添加到我的项目中,但在 TR.scala 中出现以下错误。 TR.scala 是从 Java 源代码生成的文件。

[info] Compiling 2 Scala sources and 5 Java sources to D:\Workspaces\MyProject\my-project\target\scala-2.9.0-1\classes...
[error] D:\Workspaces\MyProject\my-project\target\src_managed\main\scala\com\mydomain\myproject\TR.scala:2: object app is not a member of package com.mydomain.myproject.android
[error] import android.app.Activity
[error] ^
[error] D:\Workspaces\MyProject\my-project\target\src_managed\main\scala\com\mydomain\myproject\TR.scala:3: object view is not a member of package com.mydomain.myproject.android
[error] import android.view.View
[error] ^
[error] two errors found
[error] {file:/D:/Workspaces/MyProject/my-project/}My Project/compile:compile: Compilation failed
[error] Total time: 5 s, completed Oct 12, 2011 11:20:55 AM

最佳答案

感谢 Yifan Yu 的 response在 Google 网上论坛中,它似乎是 sbt Android plugin 中的错误.感谢 Jan Berkel,修复了 this release 中的错误.

You have a package path named com.mydomain.myproject.android, so it's confusing the compiler when it tries to compile TR.scala in 'com.mydomain.myproject', because it thinks of 'android.whatever' as a relative path. The plugin tries to prepend _root_. to the Activity source it generates, but it forgets to do so for TR.scala.

关于java - sbt:对象应用程序不是包的成员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7745442/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com