简体   繁体   English

NullPointerException启动Android应用程序

[英]NullPointerException launching Android application

Bit of a strange problem. 有点奇怪的问题。 I opened my eclipse workspace, and tried to launch my android app to test it out, and it throws a NullPointerException launching the app. 我打开了我的Eclipse工作区,并尝试启动我的android应用程序进行测试,然后抛出NullPointerException启动该应用程序。 Not even getting to the app yet. 甚至还没有进入应用程序。

eclipse.buildId=M20100211-1343
java.version=1.7.0
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86


Error
Sat Nov 12 11:23:25 EST 2011
An internal error occurred during: "Launching ww3".

java.lang.NullPointerException
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.launch(AndroidLaunchController.java:357)
at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.doLaunch(LaunchConfigDelegate.java:321)
at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:237)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:866)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1069)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Edit : Still Nothing. 编辑 :仍然没有。 Results of changing the JDK version: 更改JDK版本的结果:

eclipse.buildId=M20100211-1343
java.version=1.6.0_18
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86

You need to update your ADT. 您需要更新您的ADT。 I am not sure exactly how to do that through the menus, as eclipse displayed a dialog directing me to it after I restarted eclipse. 我不确定如何通过菜单执行此操作,因为在重新启动eclipse之后,eclipse会显示一个对话框,将我定向到该对话框。

It is worth looking into. 值得研究。

I got this error today too, but on a system that had already been running ok. 我今天也遇到了这个错误,但是在已经运行正常的系统上。 The difference was I reinstalled dropbox and it resync'd the folder containing my workspace. 区别在于我重新安装了保管箱,并且重新同步了包含我的工作区的文件夹。 Finally noticed I had two run configurations, the working one and an old conflicting one dropbox had delivered. 最终注意到我有两种运行配置,一种已经交付,另一种已经发生冲突。 The diff between the two run configurations was a checkbox next to the AVD target was unchecked. 两种运行配置之间的差异是未选中AVD目标旁边的复选框。 From the menu: Run > Run Configurations > TargetTab. 从菜单中:运行>运行配置> TargetTab。 Checkbox next to your AVD should be checked. AVD旁边的复选框应选中。 Hope it helps. 希望能帮助到你。

I had the exact same problem. 我有同样的问题。

The answer below solved it for me after wasting over a day on this madness. 在为这种疯狂浪费了一天之后,下面的答案为我解决了这个问题。

Eclipse launch error when trying to run an Android app 尝试运行Android应用时出现Eclipse启动错误

The clue is right at the top of your error trace: 提示就在错误跟踪的顶部:

java.lang.NullPointerException at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.launch(AndroidLaunchController.java:357)

Your project is trying to run in a virtual device that doesn't exist any more. 您的项目正在尝试在不再存在的虚拟设备中运行。 It doesn't find it and you are left red-faced like myself. 找不到它,您就像我一样红着脸。 You probably deleted that AVD like I did. 您可能像我一样删除了该AVD。 (so frustrating the error message isn't clearer!) (因此,使错误消息更令人沮丧的是不清楚的!)

All you need to do is relink it to an actual AVD: 您需要做的就是将其重新链接到实际的AVD:

The following comment by CharlieMezak worked for me. CharlieMezak的以下评论对我有用。

  1. right click the eclipse project 右键单击Eclipse项目
  2. click "properties" and look at "run/debug settings 点击“属性”,然后查看“运行/调试设置”
  3. Edit the settings for your project making sure that an existing AVD is checked 编辑项目的设置,确保已检查现有的AVD

I had a similar problem and none of these suggestions worked. 我有一个类似的问题,这些建议都没有奏效。

So I deleted the project (without deleting the files) then remove the .settings and .project and .classpath files from the project. 因此,我删除了项目(不删除文件),然后从项目中删除了.settings和.project和.classpath文件。

== Success ==成功

Java 7 is not listed in Android SDK Supported Development Environments yet. Java 7尚未在Android SDK支持的开发环境中列出。 Try to use JDK 1.6 instead. 尝试改用JDK 1.6。

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

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