Android: The type java.lang.Enum cannot be resolved
Asked Answered
E

3

4

I downloaded Android's Browser project (from git) and imported it to Eclipse. I cannot build it however because of the following error:

The type java.lang.Enum cannot be resolved. It is indirectly referenced from required .class files

Now... this is a development environment that has been working very well for other projects:

  1. Windows 7 Ultimate 64-bit.
  2. JDK 64-bit (jdk-6u23-windows-x64.exe installed.)
  3. Eclipse Classic 3.6 64-bit (eclipse-SDK-3.6.1-win32-x86_64.zip)
  4. Android 2.3 SDK Starter Package

So I am not sure where the problem could lie.

How do I solve this?

Eustatius answered 13/3, 2011 at 23:4 Comment(0)
A
8

At best, your build path is messed up. Right-click over the project name, and choose Build Path > Configure Build Path from the context menu. This brings up the build path portion of the project properties window, on the "Order and Export" tab. If the Android JAR is not checked, check it, then close the properties window.

At worst, you are trying to build this project purely from the SDK, which is unlikely to work, because few of the AOSP apps are designed to be built outside of the full firmware build.

Argueta answered 13/3, 2011 at 23:13 Comment(7)
@Argueta I first tried "At best". There was an unchecked box but it said something about "library not found". I checked it, closed the properties window and when I opened the properties window again, that checkbox changed to Android 2.2. It's checked, but the problem seems to have gotten worse? Instead of one .java having the error reported above, I now have numerous files reporting "The import android.net.WebAddress cannot be resolved". Does this mean I am "At worst"? If so, what's the best way to solve this? (I hope it wouldn't be downloading entire Android project)Eustatius
@Android Eve: The Browser application is not designed to be built separately, only as part of a full firmware build. The WebAddress class is part of the Android class library but is not part of the SDK.Argueta
@Argueta Wow. This turns out to be a much more huge ordeal than I anticipated. Any suggestions as to how to build own browser version? I am looking for a shortcut, I am not really interested in competing with Google. :)Eustatius
And it seems that the problem is ancient: (1) anddev.org/other-coding-problems-f5/… (2) groups.google.com/group/android-developers/browse_frm/thread/…Eustatius
"To build the Android source files, you will need to use Linux or Mac OS. Building under Windows is not currently supported." source.android.com/source/download.htmlEustatius
@Android Eve: "Any suggestions as to how to build own browser version?" -- find some existing open source Android browser that isn't from the AOSP. Or, find some other solution for whatever problem you are trying to solve.Argueta
@CommonsWare, I am having very small query about the AOSP, I am trying to use the Magnifier code from AOSP and for that I know I have to get so many resources from AOSP. In this case do I need to have ROOTED device so that all the java classes can be imported properly?Labradorite
A
3

It's not an android issue, it's an eclipse issue.

Check:

Alternant answered 13/3, 2011 at 23:13 Comment(1)
I like your answer better but unfortunately it seems that @Argueta is correct: My Eclipse env already uses that latest JRE 1.6. I guess I will have to download & build Android entirely. (unless there is a trick to resolve only those Enums)Eustatius
I
0

I upgrade from JDK 1.6.0_24 to 1.6.0_32 and the problem is gone :)

Isoelectronic answered 31/5, 2012 at 15:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.