无法启动扩展 MapActivity 的活动

发布于 2025-01-05 10:50:42 字数 960 浏览 1 评论 0原文

活动 (ShowPos) 在扩展 MapActivity 时无法启动。如果我更改为扩展 Activity,它就会启动。

它确实工作得更早,在我将项目的java代码复制/粘贴到新工作区中的新项目之前,突然Eclipse莫名其妙地找不到任何Android API,并且无法重新导入任何API。类似的事情以前也发生过几次,对于Eclipse来说似乎很平常。但复制/粘贴以前一直有效,至少在一段时间内是这样。现在它警告没有这样的错误。

我确实有一个 API 密钥,以前有用过。 现在,maps.jar 位于项目资源管理器中的项目下的 Google API 2.2 下。 编辑器注意到项目中的任何文件都没有错误。 启动后,LogCat 开头为:


 - D dalvikm Calling exit(1)
 - W dalvikm Unable to resolve superclass of Lintrax/three/ShowPos; (35)
 - W dalvikm Link of class 'Lintrax/three/ShowPos;' failed
 - D AndroidRuntime Shutting down VM
 - W dalvikm threadid=1: thread exiting with uncaught exception
   (groupnr)
 - E AndroidRuntime FATAL EXCEPTION: main

我的项目名称现在是“intrax. Three”。为什么要加一个“L”呢? 清单确实包含:(


    uses-library android:name="com.google.android.maps"
    uses-permission android:name="android.permission.INTERNET"

无法在此处粘贴清单文件)

感谢您提供有关如何帮助 Eclipse 查找内容的任何帮助!

An activity (ShowPos) cannot be launched when it extends MapActivity. If I change to extends Activity, it launches.

It did work earlier, before I copy/pasted the java codes of the project to a new project in a new workspace when suddenly Eclipse inexplicably could no longer find any Android API, and none could be re-imported. Similar things have happened a few times before, it seems ordinary with Eclipse. But copy/paste has always worked before, for a while at least. And now it warns of no such error.

I do have an API-key, which has worked before.
maps.jar is now under Google API 2.2 under the project in the project explorer.
The editor notes no errors in any file in the project.
When launched, LogCat starts with:


 - D dalvikm Calling exit(1)
 - W dalvikm Unable to resolve superclass of Lintrax/three/ShowPos; (35)
 - W dalvikm Link of class 'Lintrax/three/ShowPos;' failed
 - D AndroidRuntime Shutting down VM
 - W dalvikm threadid=1: thread exiting with uncaught exception
   (groupnr)
 - E AndroidRuntime FATAL EXCEPTION: main

My project name is now "intrax.three". Why does it add an "L" to that?
The Manifest does contain:


    uses-library android:name="com.google.android.maps"
    uses-permission android:name="android.permission.INTERNET"

(Couldn't paste the Manifest file here)

Thanks for any help about how I can help Eclipse find stuff!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

浮生面具三千个 2025-01-12 10:50:42

转到项目 ->首选项->安卓->项目构建目标并确保您创建了一个使用 Google API 的项目

Go to Project -> Preferences -> Android -> Project Build Target and make sure that you created a project that uses the Google APIs

一向肩并 2025-01-12 10:50:42

如果您已经定义了 Internet 权限并使用-library,

<uses-library android:name="com.google.android.maps" /> in your manifest.

还要确保项目目标设置为 google APi。

第三件事是您的包级别需要更正并再次构建项目,而无需显式提供任何 map.jar 库。 仅使用 google APi 内置 ma​​ps.jar 并创建扩展 MapActivity 的新活动(也请在清单中声明)。

If you have already defined the Internet permission and uses-library

<uses-library android:name="com.google.android.maps" /> in your manifest.

Also make sure that the project target is set to google APi.

Third and imp thing is your package level need to be corrected and build the project again without any map.jar library provided explicitly. Only use google APi inbuilt maps.jar and creat new activity that extends the MapActivity (Also do declare in manifest).

生生漫 2025-01-12 10:50:42

我已经按照MapView教程进行操作,它工作得很好,没有任何错误。

所讨论的错误是 链接错误,其中 Dalvik VM 无法找到您的类。这意味着这里给出的所有建议(uses-library、互联网权限、将 Google API 设置为构建目标)甚至还没有出现。链接错误意味着 Android 操作系统无法找到您的课程。因此,我建议您尝试创建一个干净的项目,在其中从 Eclipse 创建新的 Class,然后粘贴代码片段而不是粘贴文件。

顺便说一句,L 用于标识Object。参考:Java 标识符

快乐编码!

I've followed the MapView tutorial and it works just fine without any errors.

The error in question is a link error where the Dalvik VM is not able to find your class. This means all the suggestions given here (uses-library, internet permission, setting Google APIs as the Build Target) don't even come into the picture yet. Link error means that Android OS is not able to find your class. So, I suggest you try creating a clean project where you create the new Class from Eclipse and then paste the code snippet instead of pasting files.

BTW, the L is used to identify an Object. Reference: Java Identifiers.

Happy Coding!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文