34

I am facing a problem when I try to create new android project in eclipse adt plugin tools.

ERROR/EXCEPTION::

Errors occurred during the build. Errors running builder 'Android Resource Manager' on project 'test'. java.lang.NullPointerException

I have faced this problem two times previously. Only solution was to re-install Windows operating system which actually did solve the problem. But I want a real solution without re-installing Windows.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Mohammod Hossain
  • 4,134
  • 2
  • 26
  • 37

19 Answers19

17

Switching to a new workspace worked for me.

File-> Switch Workspace.

DoronK
  • 4,837
  • 2
  • 32
  • 37
15

found a better solution. in the create project wizard. don't create an activity in the wizard. just untick create an activity and just create the activity manually in the manifest.

Andre Coetzee
  • 1,260
  • 3
  • 20
  • 34
  • You right, problem with Activity Creation. Even after Create Project if create Activity from given option then it not allow. I have to go first Java class and convert it into Activity class. This way it worked. – CoDe Mar 12 '16 at 11:55
9

I guess you upgrade your java to java7u55.

because I am using mac, but, FYI

I solve this by edit eclipse.ini, force the ide to use java 1.6

-vm /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/java

you could try the same.

kaala
  • 536
  • 1
  • 5
  • 15
  • I change the ide to use java 1.6.This issue fixed. But another issue come out, which is `Parsing Data for android-L failed Unsupported major.minor version 51.0` – chancyWu Jul 15 '14 at 16:44
  • maybe you have some jar was build by java7, do a clean build may help. – kaala Jul 18 '14 at 05:09
  • 1
    Tried the same with a blank "Hello World" project. The Android Resource Manager still causes NPE. – Dirk Sep 16 '14 at 18:25
  • This one together with Hatchmaster J's answer to `chmod 777` the workspace solved the problem for me. – Ramith Jayatilleka Nov 09 '14 at 09:49
  • 1
    Thanks, It works for me. Also found this answer here: https://code.google.com/p/android/issues/detail?id=68755 – Meir Gerenstadt Jan 06 '15 at 09:59
4

In my case, the error was solved by changing the workspace folder permissions with chmod 777.

I am using Mac OS X and downloaded the ADT bundle for Mac.

Hatchmaster J
  • 543
  • 1
  • 6
  • 15
3

If you close eclipse and then look in your system processes and still see adb running, then that's the problem - it crashed. In my case it was because I have extension files for other programs in my JRE that the adb doesn't seem to like. Remove all your ext files, force shut down your adb.exe and then restart eclipse.

Root exception:

java.lang.NoClassDefFoundError: org/apache/log4j/Priority
jww
  • 97,681
  • 90
  • 411
  • 885
0ldMaid
  • 51
  • 3
2

Usually this means that they have one more time introduced a bug.

The "magic passes" that may help or not help are:

  1. Pressing F5 (refresh)
  2. Updating Android, Eclipse and ADT (knowing that you do have such a problem, I myself definitely will not do any such updates in the near future)
  3. Creating a project from the command line, building it and trying to import
  4. If you have any project that already works, you may try to take files from that project.
  5. Read the logs, they are usually more informative than just the last 30 lines, but on Windows you will have to either configure the screen buffer height to be about 300-600, or redirect the output to a file.
  6. Clean and build again.
18446744073709551615
  • 16,368
  • 4
  • 94
  • 127
2

You usually get this after an SDK/ADT update.

Go to your SDK manager and ensure that there are no updates. Then in Eclipse go to Help > Check for Updates and install any updates it finds.

Restart eclipse and hopefully it should all work.

Failing that uninstall Eclipse and re-install Eclipse and the plugins again should fix it as well, no need to re-install your whole PC.

Boardy
  • 35,417
  • 104
  • 256
  • 447
1

I use maven to build and integrate android projects with jenkins/netbeans. For editing android resources, I often use Eclipse because of the ADT plugin and better android resources support.

Eclipse (Kepler) has serious problems when you import maven-based android projects. It expects the project.properties file in the root folder and will NOT generate it on its own no matter what. Example content:

# this file is needed by eclipse (adt plugin).
# Project target.
target=Google Inc.:Google APIs x86:19

Additionally, create a sym link called "gen" pointing to target/generated-sources/r if using maven to build the android project on the command line. That way, you should be able to do "File->Import...->Existing Android Project". You get an error message, but it didn't matter in my case.

Additional hints in case you have problems with m2e-android plugin:

  • always check that the output folders for source dirs and resource dirs are correct.
  • check that source dirs are set as source dirs (you usually get a corresponding warning)
  • if resources from dependencies are not included in the final apk, check the filter settings for your resource dirs
  • you may need to "import maven project from existing sources" before importing it as android project from existing sources.
  • make sure dependencies are imported into the workspace and open and referenced (project props -> android -> add lib)
  • eclipse adt does not support aar libs, use apklib instead
user1050755
  • 11,218
  • 4
  • 45
  • 56
  • I can import android project but problem is to create a new android project – Mohammod Hossain Mar 18 '14 at 03:51
  • no problems here with that. remove all eclipse configs and start from scratch......? using Kepler on Ubuntu 12.04 LTS amd64 with the shipped jdk7 distro and latest android sdk. – user1050755 Mar 18 '14 at 12:29
0
  • It can happen if you are changing the location of files that your eclipse project uses.

  • In that case you can copy the files directly to your resources folder inside the workspace instead of linking them with "import"

sivi
  • 10,654
  • 2
  • 52
  • 51
0

These simple steps put me out of this trouble -

  1. In Eclipse, Help menu -> Check for Updates.
  2. Select all Android related plugins.
  3. Click Next, Accept the agreement page then proceed to install the plugin.
Khobaib
  • 1,577
  • 3
  • 21
  • 29
0

Make sure your java path points to the java SDK bin directory.. make sure you have installed the latest JDK t be safe..

shax
  • 1
0

You can also try one of these:

  • Close and open the project in Eclipse
  • Click right on the project and choose: Android Tools -> Fix Project Properties
Albert-Jan Verhees
  • 2,084
  • 1
  • 16
  • 19
  • It seems exactly here is somewhere the cause for my problem. By calling "Fix Project Properties" I run into the same NPE... – Dirk Sep 16 '14 at 17:14
  • Have a look at your .project file. Does it look like a normal Android project? You can also see this answer to what Fix Project Properties exactly does and try to do them one by one manually: http://stackoverflow.com/questions/6056511/what-does-the-command-fix-project-properties-exactly-do – Albert-Jan Verhees Sep 17 '14 at 07:31
0

I beat my head against a wall for a day because of the same problem. My solution (OS X): I had a stale "java_home" definition in my profile pointing to a dead symlink, as well as old classes in /Library/Java/Extensions. I removed the definition and symlink, along with two classes in Extensions (ActiveMQ and Geronimo, FWIW) and the problem went away. Not sure which step was the actual "rectifier" but if any of those conditions apply, you might want to check them.

mjbraun
  • 117
  • 5
0

I faced same problem on my New Macbook Pro so I just Downloaded JDK and installed it and problem fixed.

For Guru
  • 1,197
  • 13
  • 23
0

I was experiencing the same issue - I refreshed and updated Eclipse and Android plugins and was still seeing the NPE. What worked for me was changing the order of operations.

In order:

1. update Eclipse & Android plugins
2. after the update has completed, perform the F5 Refresh in the current workspace
Deduplicator
  • 44,692
  • 7
  • 66
  • 118
0

Make a copy of your project in Explorer/Finder. Delete the project in ADT/Eclipse. Import the project again using Eclipse. Project/Clean then build. This works for me.

0

I have tried every solution I found on the web and they did not work.Then I remember java version on my Mac was 1.7 and I have installed subversion version 1.6 and the problem occured after that installation.Also I have deleted eclipse and used a clean eclipse and Android sdk installation I still got the problem, then I uninstalled the JDK 7 as it is told in here http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jdk.html and my problem is solved.

kaplanfat
  • 81
  • 8
0

I have several projects in my folder. Every time I start a new one I close the others. I got this error because appcompat_v7 was closed.

  • Right click on appcompat_v7 and select Open Project.

This solved my problem.

0014
  • 893
  • 4
  • 13
  • 40
0

Solved after changing a setting in eclipse.ini. I am using OS X 10.11.4 and Eclipse Mars 4.5.2.

  1. Go to the folder of Eclipse.app in Finder.
  2. Right click to open a menu, and click Show Package Contents.
  3. Go to /Contents/Eclipse.
  4. Open eclipse.ini in your favorite text editor.
  5. change -vm path like below:

    BEFORE: /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/bin

    AFTER: /Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/bin

  6. reopen Eclipse.

  7. enjoy :D
Joey
  • 2,912
  • 2
  • 27
  • 32