Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (427)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [SOLVED]libgdx and eclipse problem (newbie)  (Read 4071 times)
0 Members and 1 Guest are viewing this topic.
Offline philfrei
« Posted 2013-08-01 04:42:42 »

I've newly downloaded and am running the LibGDX project setup tool and it creates a new project just fine. Upon importing to Eclipse (Juno), I get this message in the console (several times):

1  
[2013-07-31 19:07:51 - AngryMasons-android] Unable to resolve target 'android-15'

In the Problems, the first error (for the android project) is this:
1  
The GWT SDK JAR gwt-servlet.jar is missing in the WEB-INF/lib directory   lib   /AngryMasons-html/war/WEB-INF   Unknown   Google Web Toolkit Problem

The second problem seems kind of bizarre also:
1  
The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project   AngryMasons-android      Unknown   Java Problem


The AngryMasons-android project does not include "GWT SDK" library or the "JRE System Library[jre7]" or "App Engine SDK". Should it? If I manually add these libraries, it does no good.

A "quick fix" on the gwt-servlet.jar error does put a copy into the -html/war/WEB-INF. But the other errors remain.

After the jre7 library is added, there is this:
1  
The project was not built since its build path is incomplete. Cannot find the class file for android.app.Activity. Fix the build path then try building this project   AngryMasons-android      Unknown   Java Problem

And, on the code page that was generated, the very first import has an error:
1  
The import android.os.Bundle cannot be resolved


Where is this library normally found?

I could go on listing errors but they are probably just cascades from the first errors, right?

Any help would be much appreciated. I'm quite stuck.

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 121
Projects: 4
Exp: 3 years



« Reply #1 - Posted 2013-08-01 05:11:08 »

You've probably already seen this in the setup tutorial, but you need the Android SDK...
https://code.google.com/p/libgdx/wiki/ProjectSetup
Offline philfrei
« Reply #2 - Posted 2013-08-01 08:33:16 »

Oh--Android doesn't play well with Java 7?  Cranky I have to go back and reload Java 6?  Cranky

I was working with the "Prerequisites" link just above this tutorial, and then the tool "gdx-setup-ui.jar". I didn't think to look at the Manual Project Setup.
 
If Android doesn't work with Java 7, why does the "Prerequisites" link for Java JDK point to...Java 7?  Huh

I may be kind of dense, but it kind of bugs me that the link to loading the Android SDK on an existing IDE points to a page that prominently displays a bundle that includes Eclipse, and the download for just the Android SDK is buried in the "Other platforms" area. I missed that twice.

I'm very tempted to just download the bundle and work with multiple Eclipse copies. Yay, another 200+ MB download!

(grousing aside, I do thank you, Jimmt for the link)
(and it is simply amazing that all this technology is free)

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Orangy Tang

JGO Kernel


Medals: 51
Projects: 11


Monkey for a head


« Reply #3 - Posted 2013-08-01 09:18:58 »

I've newly downloaded and am running the LibGDX project setup tool and it creates a new project just fine. Upon importing to Eclipse (Juno), I get this message in the console (several times):

1  
[2013-07-31 19:07:51 - AngryMasons-android] Unable to resolve target 'android-15'

When I was using the project setup tool a few days ago I found that regardless of what I entered in the tool setup options, the generated project was always dependant on release 15 of the android sdk.

Assuming you've downloaded the latest one (which I think is 18) then it's easiest to open the .project and Android-Manifest.xml files in the -android project and manually alter it.

Edit: When you do modify it, make sure to restart Eclipse, then do a full clean/rebuild.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline gimbal

JGO Coder


Medals: 25



« Reply #4 - Posted 2013-08-01 13:23:20 »

I wonder: would using a Java 7 JDK but setting the compiler (in the workspace or project preferences) to Java 1.6 compliance work? The linked documentation states that you need to be using Java 1.6, but it does not state if you need to physically install a Java 6 JDK.
Offline philfrei
« Reply #5 - Posted 2013-08-01 20:47:42 »

I'm struggling with this mightily because of everything being new.

The Android SDK Manager shows that I have Android 4.3 (API 18). The game-android project's "AndroidManifest.xml" lists the "targetSdkVersion" as 17. I changed this to 18.

To 'reload' the project, I did the following:
(1) closed & reopened Eclipse (2) Project/clean, selecting the project files, (3) Refresh <F5> on the project itself.

Same errors.

About the JRE7--I loaded a separate tutorial/example from Google/Android that demos a "GreetingService", and it is running fine, but the project is structured very differently. It has a copy of the jre7 library listed, so this makes me wonder if the presence of jre7 is really the problem. This tutorial project has the following libs and structures NOT in the game-android project generated by libgdx's project setup tool:

App Engine SDK [App Engine - 1.8.2]  (all the jars are listed as being in an Eclipse plugins folder)
GWT SDK [gwt-2.5.1 - 2.5.1]  (all jars are listed from a download I had done of the toolkit and stored on my desktop/Java/gwt file folder)
JRE System Library [jre7]

And of course there are things like a war file folder, and WEB-INF, which I presume are not used for an Android program or the Android emulator.

*********

I just tried manually adding the jre6 rather than the jre7 to the game-android project as a library. I don't think it made any difference. The error about the class Object not being found goes away, but the other errors remain. The first problem listed is now (as before):
"Cannot find class file for android.app.Activity " etc. a build path issue.
Also, the class file MainActivity's first error is on the import line:
"import android.os.Bundle;"

Any thoughts where one might find these?

I've download the "bundle" that includes a version of Eclipse with plugins already set up (presumably). Haven't tried installing that yet and seeing if the game-android project works any better in that context. I also have yet to go through the manual install tutorial in detail. I guess I'll do that next (after a search for "android.app.Activity" or "android.os.Bundle").

Dang. Three days lost on my "schedule" due to this. Am wondering, maybe just delete the -android emulation and go forward with the rewrite of my game based on the -desktop and -html only. Worry about the -android version later? I kind of wanted to get the whole libgdx thing working first and finish Dustin Riley's tutorials as a first step in getting acquainted with libgdx.

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Offline philfrei
« Reply #6 - Posted 2013-08-01 21:29:14 »

OK.

android.os.Bundle and android.app.Activity are part of the "android.jar" that was stored at a subfolder of the location listed by the Eclipse "SDK Path" listed in the Android SDK manager.

/android-sdk/platforms/android-18/android.jar

Why wouldn't the setup automatically include a path to this jar? (The SDK path listed ends on "android-sdk".) Did I configure something incorrectly?

I tried explicitly linking this as an "external jar" and all the errors in the MainActivity class go away. What I have now are a series of these errors:

Unable to resolve target 'android-15'
Unable to resolve target 'android-15'
Unable to resolve target 'android-15'
Unable to resolve target 'android-15' until SDK is loaded.
Unable to resolve target 'android-15' until SDK is loaded.
Unable to resolve target 'android-15' until SDK is loaded.

Any ideas?

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Offline Herjan

Senior Member


Medals: 6
Projects: 1



« Reply #7 - Posted 2013-08-01 21:32:50 »

Yes, go to android project, rightclick, Properties -> Android and check your Android x.x.x Android 4.2.2 for example Grin Good luck coding!
Offline philfrei
« Reply #8 - Posted 2013-08-01 22:30:19 »

Thank you!
All problems/errors are gone.

I've been working through the "manual" project start and was just noticed that Eclipse's new project/Android project automatically adds the Android 4.3 library.

Clicking the properties/Android/Project Build Target: Android 4.3 seems to have accomplished the same thing with the project made via the libgdx project setup tool. Perhaps this could/should be added as another step in the libgdx project building tool, along with the instructions for correcting the "warnings" that come with some jars that need synchronizing?

This gets rid of the ridiculous error where java's Object.class was not found. I can delete the manual addition of the jre6 as a library.

There are still a couple of differences. The "manually" created android project had "android-support-v4.jar" automatically included, and the libgdx setup tool android projects does not. There are a couple differences in terms of whether other jars are in the "Android Private Libraries" or "Referenced Libraries" in the two projects. But I'm guessing this doesn't matter, and I'll worry about the "android-support-v4.jar" presence later.

OK, on with the game tutorial!  Smiley

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Offline Herjan

Senior Member


Medals: 6
Projects: 1



« Reply #9 - Posted 2013-08-02 00:03:27 »

Ah, nice everything works now Wink

I hope your tutorial isn't starting with making menus as they are really complicated/confusing in LibGDX and I had a lot of trouble with making them as there are 1000 texture packers and only 1 properly works, (with 9patches), it was just very confusing for me, as this text is for you since you don't know what texture packers/9patches are...

Now I know how it works, its great stuff, but all those youtube guys who teach beginners and start direct with making a menu for their game... Bad job... And the most terrifying thing is that they don't even explain what they do... Bucky has to do a LibGDX tutorial, oO!

Nonetheless, LibGDX itself is great!
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (76 views)
2014-04-15 18:08:23

BurntPizza (68 views)
2014-04-15 03:46:01

UprightPath (80 views)
2014-04-14 17:39:50

UprightPath (66 views)
2014-04-14 17:35:47

Porlus (81 views)
2014-04-14 15:48:38

tom_mai78101 (105 views)
2014-04-10 04:04:31

BurntPizza (165 views)
2014-04-08 23:06:04

tom_mai78101 (261 views)
2014-04-05 13:34:39

trollwarrior1 (210 views)
2014-04-04 12:06:45

CJLetsGame (220 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!