I have used google, read all Questions here on StackExchange but still couldnt solve my Problem.
So Im following a tutorial from kilobolt(Zombie Bird).
The desktop-version of the game is running without problems, but if I want to run it on an android emulator I get this error message:
"Couldn't load file: data/logo.png"
The line where I get the error looks like this:
logoTexture = new Texture(Gdx.files.internal("data/logo.png"));
My Android Path looks like this:
-Android
-Assets
-Data
-logo.png
I assume this is the correct path.
I have tried cleaning the project, I used Gradle > Refresh All, I restarted Eclipse.
Nothing worked.
Im a little bit confused cause if I move the file outside of Data but in the Assets Folder and change the path to this:
logoTexture = new Texture(Gdx.files.internal("logo.png"));
It works.
Can someone explain me why I cant use the Data Folder inside of Assets?
What emulator are you using to run it? For me, the same code works properly on an actual Android device, so I'd assume it is an Emulator error. Possibly has to do with the / as the seperator character. This is just a wild guess, but does
logoTexture = new Texture(Gdx.files.internal("data" + File.separator + "logo.png"));
fix it, or break it?
maybe it's caused by the difference of OpenGl ES 1 and OpenGl ES 2...
Using OpenGl ES 1 the picture size has the power of two. Bear with me - I'm new to libgdx.. :)
Related
Yesterday, I downloaded a Project which was in eclipse and i imported it in my android studio may be due to this or some other reason today when i opened my android studio recent projects it was showing error in gradle file with some other language i searched for the error which was "File was Loaded in Wrong Encoding UTF-8 " and got a method to change from file
Please help me out what should i do i tried searching every where but could not get a fine result which worked for me.
Here is my sample code of .xml file which is don't know in which format and why
���� 3
0abc_background_cache_hint_selector_material_dark I
ConstantValue 1abc_background_cache_hint_selector_material_light (abc_btn_colored_borderless_text_material abc_btn_colored_text_material abc_color_highlight_material !abc_hint_foreground_material_dark "abc_hint_foreground_material_light !abc_input_method_navigation_guard +abc_primary_text_disable_only_material_dark ,abc_primary_text_disable_only_material_light abc_primary_text_material_dark
abc_primary_text_material_light abc_search_url_text abc_search_url_text_normal
abc_search_url_text_pressed abc_search_url_text_selected abc_secondary_text_material_dark !abc_secondary_text_material_light abc_tint_btn_checkable abc_tint_default abc_tint_edittext abc_tint_seek_thumb abc_tint_spinner abc_tint_switch_track accent_material_dark accent_material_light !background_floating_material_dark "background_floating_material_light background_material_dark background_material_light (bright_foreground_disabled_material_dark )bright_foreground_disabled_material_light 'bright_foreground_inverse_material_dark (bright_foreground_inverse_material_light ! bright_foreground_material_dark " bright_foreground_material_light # button_material_dark $ button_material_light % cardview_dark_background & cardview_light_background ' cardview_shadow_end_color ( cardview_shadow_start_color ) colorAccent * colorPrimary + colorPrimaryDark , %design_bottom_navigation_shadow_color - design_default_color_primary . !design_default_color_primary_dark / design_error 0 design_fab_shadow_end_color 1 design_fab_shadow_mid_color 2 design_fab_shadow_start_color 3 !design_fab_stroke_end_inner_color 4 !design_fab_stroke_end_outer_color 5 !design_fab_stroke_top_inner_color 6 !design_fab_stroke_top_outer_color 7
It was a Fine Working Projects and every thing was working but dnt know what happned tried to reset that was also not working
Searched Alot Tried to make Sdk Locations Update Updated Gradle due to which all my class files were back to normal form but this Xml File was Not re-formatted So At last i created a new Xml File.
But After Some search i come to a result that it might me due to Unwanted Closer of my Android Studio Or may be my battery drained due to which my Android Studio doesn't Closed Properly.
If Any One Know After Every update i can do one more thing so that i can re-arranged my xml file to original format I will Update My Answer if that Worked For me
Thank You.
I developed a simple javafx application to be ported in Android Environment, however I cant type any characters in the TextField. I guess its a bug, how to fix this one?
Th problem on galaxy S5 android 5.0.1 is not present but on galaxy tab 4 android 5.0.2 it doesn't work i type but none is displyed.
Tried with normal textfield. And the problem persist also I have added the properties .
Another strange rhig is that the space where recognizer. And the del button . The text not
THe code by example is very easy
Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds();
double width = visualBounds.getWidth();
double height = visualBounds.getHeight();
TextField tt= new TextField();
tt.setTranslateY(-150);
StackPane stackPane = new StackPane();
stackPane.getChildren().addAll(tt);
borderpane.setCenter(stackPane);
Scene scene = new Scene(borderpane, width, height);
stage.setScene(scene);
Assuming that CustomTextField is just a custom TextField, this is a known issue, not related to the CustomTextField itself, given that it works in other device.
If you debug it:
./adb logcat -v threadtime
you surely find an exception that explains the issue: a StackOverFlow exception.
On older devices it can be solved adding this: create a java.custom.properties file, and include in it this property:
monocle.stackSize=128000
You may also include this one:
monocle.platform=Android
(it will be soon included by default in the next version)
Put the file at the root of your classpath, e.g. in the folder src/android/resources of your project.
Build and deploy the project on your mobile and check again.
I'm getting a very weird error ever since I have "ported" the spritebatch code from Nokia's site. It runs well as a desktop applcation emulated by POWERVR. But on Android I only get a blank screen (in fact its black.) This happens if I just try to display a image, but it doesn't crash.
Here is where comes the weird part comes in: if i put glGeterror(); in the update function it works fine! (slowly, but displays everything fine) and geterror code returns 0. I have no idea what is going on or how to debug it, as I'm new to OpenGL but everything looks correct in the source. I spitted geterrors all around the code but without any clue. I've attached my project if you want to take a look. You will need Visual Studio + vsandroid to compile.
apparently the problem is not on the sprite batch, but in the java code. I replaced for another one that uses surface view and no longer im getting this esotheric behavior.
I'm having trouble getting Eclipse to see that I've just put a new image into my project when referencing that image using R.drawable.this_text
So I drag my png into myProject/res/drawable-hdpi in Eclipse's Project Explorer. The name of the image is this_text and it's a png!
So I go into my application and I want to put this on the screen; So here's the code for that...
private void setTitle()
{
ImageView title = new ImageView(this); //this extends activity
title.setBackgroundResource(R.drawable.this_text);
...
}
This I have done before and each time I do it I experience the same thing:
if i just dragged my this_text.png into the Project Explorer in eclipse, the word "this_text" will be underlined in red, and not allow me to compile or proceed. I try to F5 (refresh) the project. I try refreshing the image foldr, the src, the actual java...etc! I try closing and opening eclipse but nothing really works. So I quit for afew minutes and work elsewhere in my application, and eventually this error goes away!
Well I'm impatient today-- And I'd rather know how to solve this incase I need to do any quick programming! So does anyone know what to do?
I'm using eclipse Version: Indigo Service Release 1.
Thanks- Ethan
R files for android are generated. Rather than refreshing you should be able to CLEAN the project which should fix your issue. You could even just delete the error from the problems list which would allow for compilation to start and for the generated R file to be created. Or you could make a change to an xml which would also allow for the file to be regened. As always make sure you are up to date on your tool chain.
I already tried to find some answer for this but unfortunately I couldn't. I am trying to teach myself Android. Apparently, for no reason, Eclipse stops recognizing a variable between one line and the next one.
I have a class that extends a View (a custom View). I am getting this error on the onDraw (sorry, can't post image)
public void onDraw(Canvas c) {
c.drawBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher), 0, 0, null);
c.Rotate(-10);
}
The drawBitmap line is not recognized as error. If I go after the . in the drawBitmap line and press Ctrl+Space, I get just the Java.Object functions (Equals, hashCode, etc) and not the Canvas'. The c.Rotate line is marked as error - if I open c. the autocomplete does not recognize anything but the basic object functions (no draw, rotate, get/set, etc);
If I try to use the variable before the DrawBitmap, it also won't recognize.
The weird thing is: if I keep just the drawBitmap line, it compiles and runs fine.
What could it be?
EDIT:
Eclipse
Version: 3.7.2
Build id: M20120208-0800
Android Development Toolkit
Version: 16.0.1.v201112150204-238534
Build Target: Android 2.2 (Rev 8)
SOLUTION:
I just had to go into the workspace folder and delete the .Metadata, and re-add the project. I don't know what caused this error, but it got fixed. For more information, please check the first answer. If someone knows what happened, I would find it very interesting to understand what happened.
should be lowercase rotate
c.rotate(-10);
the rest is very mysterious