LibGDX project can't find assets folder - java

I have suddenly run into an issue with my build environment and I can't figure out why. I can run my project just fine using gradlew desktop:run however, when I try to run the project from Eclipse using right-click run as desktop application (on the desktop project of course) it suddenly cannot find my pack.atlas file. There is no doubt the file exsts. I have refreshed my eclipse project multiple times and the project runs fine using gradle commandline. It was working fine yesterday. The only thing I can think of that made it mess up was I ran a Gradle command from within the IDE yesterday but I'm not sure how it could have got messed up like this. It is important for me to figure out this issue as I cannot use the Eclipse debugger with this error. Does anyone have any guess as to why Eclipse isn't seeing the assets folder?

Probably your assets from the android project is not correctly linked with the desktop project.
Your linked assets folder from inside the desktop project should look like this:
If it doesn't(or it doesn't exists) ,delete the folder(in the desktop project),and go to the the project properties->java build path->source->link source
browse->[select the asset folder inside the android project]->finish

Related

Code works fine in eclipse but crashes when exported

So, I've made a game using Libgdx in eclipse for android/desktop. The strange thing is that when I export it to a desktop app, it doesn't exports my assets into the JAR(I should put them manually for it to work properly). When I try running my app on android (AVD's and my phone) it uploads the app, but then stops(Unfortunately the game stopped).
http://imgur.com/a/6x8a3 You can see my project structure here.
I've double checked if the "Extract required libraries...." is enabled and if the assets folder is set as a working directory. I also got the latest version of Gradle installed and tested in cmd.
The weird things is that if I save and send my project to a friend of mine, he can export it to desktop and it exports all of the assets and he also can run it on his tablet and AVD - so i thing the problem is not from the code, but from the eclipse/gradle settings.
Any ideas how to fix this problem?

Using Git with Eclipse causing lots of errors

I made a HelloWorld app in Eclipse that had no errors and runs fine. It was located in
Android/workspace/HelloWorld
Then I created a Git repo elsewhere in, say
Git/MyApp
I want to have MyApp contain the HelloWorld project from eclipse, and when I make edits to HelloWorld, it will show up in git status and I can commit and push those changes.
I tried copying the HelloWorld directory from the workspace into MyApp, then pushing my changes to my repo, which was fine.
Then I deleted the original HelloWorld in the workspace, went to Eclipse, hit import existing project, and selected the HelloWorld from the MyApp repo. But this resulted in a ton of compilation errors. How can I do what I'm trying to do without all these errors?
I've attached a link to a screenshot of the errors I get upon compilation.
I have Understood your problem,your project have a relationship with appcompact.Whenever you import your project you have to check below scenario,
Right click your project ---->select properties--->In side bar select "Android" Tab--->now you can see Project build target and Library Box--->in Library box click add and choose appcompact project and then click apply.
After done above one clean and build your project.Then it will work fine.
try Clean operation on your project and then build your project. replay whether it solves the issue or not.
As a matter of fact it looks to me like your eclipse doesnt recognize your app-compat anymore.
This happend to me once too, after I closed and reopend the appcompat-project.
Try to close all your projects -> open the appcompat first -> restart eclipse and maybe do a clean on your project
Hope this helps.

Trouble importing and running the Google Cardboard sample project

You can find the project here: https://github.com/googlesamples/cardboard
The last time I worked with android was about a year ago and I'm trying to use this VR project to get back into it. All I want to do is mess around with the app to get a feel for it.
However, I haven't been able to get it running. I installed a fresh copy of Eclipse (juno) with the JDK and android SDK and got the android 4.4W stuff from the SDK manager. I also made a Nexus 5 AVD.
My problem is that I've tried choosing multiple 'root' folders to 'import as existing android project' and none of them have been runnable. Each time the eclipse terminal gives an 'Installation error: Unknown failure' error after installing 'MainActivity.apk'.
I figured the 'main' folder would be most likely to work since it has the manifest and all the other folders associated with android projects.
How do I get it running?
#CommonsWare: I have the project up and running on Eclipse(Juno) with Android 4.4.2
#ThroatOfWinter: These steps should help you. They worked for me.
Download the project from github as a ZIP file
Extract the contents of the ZIP file (named cardboard-master) into a folder and then import the whole folder into Eclipse as a new android project
Create a new "libs" folder in your project
To use the Cardboard API, download the VR Toolkit .jar file and include it in your project in the "libs" folder.
If everything has worked fine so far, you'll find that the "src" folder in your new Cardboard project is empty but the "java" folder contains 3 .java files.
Create a new package in "src" called "com.google.vrtoolkit.cardboard.samples.treasurehunt"
Copy the 3 files from the "java" folder and paste in the package you created in the previous step.
Clean and build the project
Test on an android device (preferably) with the cardboard app installed
You shouldn't need to edit the manifest at all.
That is not an Eclipse project. It is for use with Android Studio and Gradle. Your choices are:
Switch to Android Studio, or
See if somebody else has already reorganized that code into an Eclipse project, or
Attempt to reorganize it yourself, moving the contents of src/main/ into appropriate locations and fixing up the manifest for things that are set now in build.gradle, or
Find something else as a project to get back into Android development
This alternative worked for me: https://github.com/raasun/treasurehunt
It's pretty much the same as the Cardboard sample project from Google except that it's compiled with Eclipse/ANT instead of Android Studio/gradle.
Just follow the first part of moyheen's instructions to set it up.
To make it work on Eclipse, I just placed the Cardboard API jar (cardboard.jar) at the root folder of my app (alongside AndroidManifest.xml), and then in Build Path dialog I just did "Add Jar" and selected cardboard.jar.
Warning: Placing cardboard.jar in libs/ folder won't work, I tried, and it will produce an invalid APK that can't be installed.

Can't link to cocos2dx using eclipse for android on OSX

I've never spent so much time on initial setup for a development environment before, this is getting kind of ridiculous.
I'm trying to run the demo code that comes with cocos2dx.
I'm using:
the eclipse flavor that comes with the ADK.
cocos2d-2.1beta3-x-2.1.0
ndk-r8c
Ive tried building an app template using create-android-project.sh which I had the same problems with but for this question I'll reference the hello.cpp sample app.
I run the build_native.sh script and then import it in eclipse.
Next is where all the different tutorials I've tried vary. Some say to 'convert to a c++ project' some say you can already 'run as android project' at this point already.
For me it seem like the android java project can't link to the cocos2dx project.
I get:
The import org.cocos2dx.lib cannot be resolved
for
import org.cocos2dx.lib.Cocos2dxActivity
No tutorial really made any mention of having to build the cocos2dx libraries except for one that said you now have to import the cocos libraries as projects in to the eclipse workspace. So Ive done that and built them but there are some errors in them after building.
I've also tried adding the folder path to link to in the project which for me is at /cocos2d-2.1beta3-x-2.1.0/cocos2dx/platform/android/java/src/org/cocos2dx/lib but that didn't help.
Any idea why I can't build/run the examples that come with cocos2dx even when following the build instructions that are on the cocos2dx website to the T?
I'm doing this now on OSX as well and this fixed it for me:
run the adroid script create-android-project.sh then
import that new project into Eclipse
in the new Eclipse project right-click the src folder > left-click 'Import'
in the Import window choose Android > Existing Android Code Into Workspace > Next >>
Browse to '/cocos2dx/platform/android/java' ('/cocos2dx/' should be be one level above the new project's directory)
click Finish. If the error persists try a Project > Clean

Android+Eclipse project sharing via SVN?

I am very new to Eclipse (Galileo, Eclipse IDE for Java Developers) and working on my first Android app, but have used SVN on many other kinds of projects and development. Last night I took my first crack at pushing the new source into a shared repository (at work) and then pulling it back down at home.
Based on an SO question/answer, I had ignored the bin and gen folders, but added everything else. When I got home, I had hoped it would be as easy as pointing eclipse to the newly downloaded source tree.
I tried setting the workspace (requested when eclipse started) to the precise folder holding all source. Nothing showed up. It was as if I were starting fresh regardless of all the source and files sitting in the workspace folder.
Then I thought maybe I needed to open a "project" file to get things rolling. Opening the .project file yielded the contents of that file in the XML editor of eclipse.
What am I missing here? Is the project metadata not stored in the source tree? Do I have to build project metadata up on every machine that gets a working copy of the source? Is this something wrong with my home Eclipse install? Can someone give me an overview of how they (successfully) do this?
You should be able to do it like you tried. Make sure you have the Android Development Tools (android eclipse plugin) installed along with the android SDK and make sure you set up ADT before you open the project.
Not checking in the bin directory makes sense to me, but I do check in the gen folder and don't have any problems.
Here is what I do to open a project from SVN if the source is already on the machine:
Open eclipse
Click on File->Import
Select General->Existing Projects into Workspace
Or you can also do this:
Open Eclipse
File -> Import
Select SVN -> Checkout Projects from SVN
Follow the steps to get from SVN

Categories

Resources