简体   繁体   English

Eclipse ADT 22.6.2仍然提供错误“java.lang.NullPointerException”

[英]Eclipse ADT 22.6.2 still gives the error “java.lang.NullPointerException”

This issue is supposed to be fixed by the latest ADT release(22.6.2), but I'm still receiving the same error when I'm trying to create an empty Android Application Project. 这个问题应该由最新的ADT版本(22.6.2)修复,但是当我尝试创建一个空的Android应用程序项目时,我仍然收到相同的错误。 Here is the exact error: 这是确切的错误:

Errors occurred during the build. 构建期间发生错误。 Errors running builder 'Android Resource Manager' on project 'MyFirstApp'. 在项目“MyFirstApp”上运行构建器“Android Resource Manager”的错误。 java.lang.NullPointerException 显示java.lang.NullPointerException

Am I missing something here? 我在这里错过了什么吗? btw I'm using OSX-Maverics 10.9.2 顺便说一下,我正在使用OSX-Maverics 10.9.2

ADT bundle does not work with the Oracle Java 7 SE JDK, failing with an NPE in the Android Application Project wizard. ADT捆绑包不能与Oracle Java 7 SE JDK一起使用,在Android应用程序项目向导中使用NPE失败。

Here's a workaround that lets you keep Java 7 as the default but run ADT with Java 6 when you have both installed. 这是一种解决方法,可以让您将Java 7保留为默认值,但在安装了Java 6时使用Java 6运行ADT。 Bring up $ADT_DIR/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini in an editor. 在编辑器中添加$ ADT_DIR / eclipse / Eclipse.app / Contents / MacOS / eclipse.ini。 (Eclipse.app is a hidden directory) (Eclipse.app是一个隐藏目录)

Before the -vmargs line, insert these two lines: 在-vmargs行之前,插入以下两行:

-vm -vm

/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Commands/java

For those who experience the same problem, here is how i fixed it: After a couple of try and errors, I found out the problem was about creating an activity in the create project wizard. 对于那些遇到同样问题的人来说,这就是我如何修复它:经过几次尝试和错误,我发现问题是关于在创建项目向导中创建一个活动。 If you simply deselect the create activity button at the 2nd step of the wizard, it creates the project succesfully. 如果只是在向导的第2步中取消选择“创建活动”按钮,则会成功创建项目。 After that, you can add a new activity to your project easily 之后,您可以轻松地向项目添加新活动

I solved this issue today.hope it helps you... 我今天解决了这个问题。它可以帮助你......

In package explorer you will find appcompat_v7 appcompat_v7_2 appcompat_v7_3 etc depending on the number of project you have in workspace.... dont close any of those packages... double click on the package to keep each one of it alive... then the issue is gone... it allows me to create new projects and new activities... 在软件包资源管理器中你会找到appcompat_v7 appcompat_v7_2 appcompat_v7_3等等,具体取决于你在工作区中拥有的项目数量....不要关闭任何这些软件包...双击软件包以保持每个软件包的存活...然后问题消失了...它允许我创建新项目和新活动......

I solved this issue following this steps: 我按照以下步骤解决了这个问题:

  1. Download Eclipse JUNO, not Kepler, in version Java EE. 在Java EE版本中下载Eclipse JUNO,而不是Kepler。
  2. Install plugin ADT using "Install new Software" in eclipse 在eclipse中使用“安装新软件”安装插件ADT
  3. Install android-sdk using Brew 使用Brew安装android-sdk
  4. Referencing android-sdk folder (example: usr/local/Cellar/android-sdk) in eclipse 在eclipse中引用android-sdk文件夹(例如:usr / local / Cellar / android-sdk)

It Works for me! 这个对我有用! Obs: I`m using Mac OS X Mavericks 10.9.3. Obs:我使用的是Mac OS X Mavericks 10.9.3。

更新$ ADT_DIR / eclipse / Eclipse.app / Contents / MacOS / eclipse.ini为我解决了这个问题,正如这个答案所建议的那样

I found a solution for MacOS X which is totally different from above mentioned solutions list. 我找到了一个MacOS X的解决方案,它与上面提到的解决方案列表完全不同。 A point need to be considered carefully which is "Java null pointer exception" so somewhere java missing in eclipse when we create a project. 需要仔细考虑一点,即“Java空指针异常”,因此当我们创建项目时,eclipse中缺少java。

Solution here, 解决方案,

  1. Eclipse -> Preferences (in MacOS X, it may different from windows7 hopefully we could see this preferences on Windows menu) at Menu bar Eclipse - > Preferences(在MacOS X中,它可能与windows7不同,希望我们可以在Windows菜单上看到这个首选项)在菜单栏

  2. Go to, Java -> install JREs-> Execution environment. 转到,Java - >安装JREs->执行环境。

  3. When you click on Java 1.7, Java 1.6 in right panel, in left pane java sdks 1.7 will shown with check box. 当您单击右侧面板中的Java 1.7,Java 1.6时,左侧窗格中将显示带有复选框的java sdks 1.7。
  4. Just checked the check box value and Press the "OK" button. 只需选中复选框值,然后按“确定”按钮。

Then try, hopefully you can create a project without any NPE. 然后尝试,希望你可以创建一个没有任何NPE的项目。

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

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