{"id":6909,"date":"2014-05-11T17:43:27","date_gmt":"2014-05-11T17:43:27","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/11\/libgdx-on-ios-gdxruntimeexception-couldnt-load-file-collection-of-common-programming-errors\/"},"modified":"2014-05-11T17:43:27","modified_gmt":"2014-05-11T17:43:27","slug":"libgdx-on-ios-gdxruntimeexception-couldnt-load-file-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/11\/libgdx-on-ios-gdxruntimeexception-couldnt-load-file-collection-of-common-programming-errors\/","title":{"rendered":"libgdx on ios GdxRuntimeException couldn&#39;t load file-Collection of common programming errors"},"content":{"rendered":"<p>I decided to move my application from Android to iOS. Application use libgdx library. I generated ios subproject using libgdx and opened it using Xamarin Studio. All images are linked from my-project-android\/assets\/data. All images have set build Action &gt; content. Now every time when run project from xamarin studio i get GdxRuntimeException Coldn&#8217;t load file: data\/background.png. This file is the first image which i load in my application.<\/p>\n<p>All operation i have done on my mac both with simulator and iPhone device.<\/p>\n<p>StackTrace:<\/p>\n<pre><code>    com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: \/data\/background.png ---&gt; System.Exception: unknown protocol: file\nat java.net.URL..ctor (java.net.URL context, System.String spec, java.net.URLStreamHandler handler) [0x00000] in :0\n--- End of inner exception stack trace ---\nat com.badlogic.gdx.graphics.Pixmap..ctor (com.badlogic.gdx.files.FileHandle file) [0x0004c] in \/Users\/badlogic\/jenkins\/workspace\/libgdx-mac\/gdx\/src\/com\/badlogic\/gdx\/graphics\/Pixmap.java:140\nat com.badlogic.gdx.graphics.glutils.FileTextureData.prepare () [0x00052] in \/Users\/badlogic\/jenkins\/workspace\/libgdx-mac\/gdx\/src\/com\/badlogic\/gdx\/graphics\/glutils\/FileTextureData.java:64\nat com.badlogic.gdx.graphics.Texture.load (TextureData data) [0x00036] in \/Users\/badlogic\/jenkins\/workspace\/libgdx-mac\/gdx\/src\/com\/badlogic\/gdx\/graphics\/Texture.java:175\nat com.badlogic.gdx.graphics.Texture.create (TextureData data) [0x0000d] in \/Users\/badlogic\/jenkins\/workspace\/libgdx-mac\/gdx\/src\/com\/badlogic\/gdx\/graphics\/Texture.java:159\nat com.badlogic.gdx.graphics.Texture..ctor (com.badlogic.gdx.files.FileHandle file, com.badlogic.gdx.graphics.Format format, Boolean useMipMaps) [0x00060] in \/Users\/badlogic\/jenkins\/workspace\/libgdx-mac\/gdx\/src\/com\/badlogic\/gdx\/graphics\/Texture.java:133\nat com.badlogic.gdx.graphics.Texture..ctor (com.badlogic.gdx.files.FileHandle file) [0x00001] in \/Users\/badlogic\/jenkins\/workspace\/libgdx-mac\/gdx\/src\/com\/badlogic\/gdx\/graphics\/Texture.java:122\nat com.kaproel.trafficControlManager.MainMenuScreen..ctor (com.kaproel.trafficControlManager.trafficControl game) [0x00088] in \/Users\/Piotr\/Developer\/mono-iOS\/trafficControl\/src\/com\/kaproel\/trafficControlManager\/MainMenuScreen.java:64\nat com.kaproel.trafficControlManager.trafficControl.create () [0x00024] in \/Users\/Piotr\/Developer\/mono-iOS\/trafficControl\/src\/com\/kaproel\/trafficControlManager\/trafficControl.java:32\nat com.badlogic.gdx.backends.ios.IOSGraphics.OnLoad (System.EventArgs arg0) [0x00010] in \/Users\/badlogic\/jenkins\/workspace\/libgdx-mac\/backends\/gdx-backend-iosmonotouch\/src\/com\/badlogic\/gdx\/backends\/ios\/IOSGraphics.java:133\nat OpenTK.Platform.iPhoneOS.iPhoneOSGameView.RunWithFrameInterval (Int32 frameInterval) [0x00041] in \/Developer\/MonoTouch\/Source\/monotouch\/src\/OpenGLES\/OpenTK_1.0\/Platform\/iPhoneOS\/iPhoneOSGameView.cs:694\nat OpenTK.Platform.iPhoneOS.iPhoneOSGameView.Run () [0x00000] in \/Developer\/MonoTouch\/Source\/monotouch\/src\/OpenGLES\/OpenTK_1.0\/Platform\/iPhoneOS\/iPhoneOSGameView.cs:652\nat com.badlogic.gdx.backends.ios.IOSApplication.FinishedLaunching (MonoTouch.UIKit.UIApplication uiApp, MonoTouch.Foundation.NSDictionary options) [0x0023e] in \/Users\/badlogic\/jenkins\/workspace\/libgdx-mac\/backends\/gdx-backend-iosmonotouch\/src\/com\/badlogic\/gdx\/backends\/ios\/IOSApplication.java:166\nat at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)\nat MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in \/Developer\/MonoTouch\/Source\/monotouch\/src\/UIKit\/UIApplication.cs:38\nat com.kaproel.trafficControlManager.Application.Main (System.String[] args) [0x00000] in \/Users\/Piotr\/Developer\/mono-iOS\/trafficControl-ios\/Main.cs:33\n<\/code><\/pre>\n<p>Please give me same idea of solution<\/p>\n<p>Snipe of code:<\/p>\n<pre><code>  public MainMenuScreen(final trafficControl game) {\n    this.game = game;\n    this.stage = new Stage(0, 0,true);\n    batch = new SpriteBatch();\n\n    this.camera = new OrthographicCamera();\n    this.camera.setToOrtho(false, 800, 480);\n\n\n    texture = new Texture(Gdx.files.local(\"data\/background.png\")); \/\/<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I decided to move my application from Android to iOS. Application use libgdx library. I generated ios subproject using libgdx and opened it using Xamarin Studio. All images are linked from my-project-android\/assets\/data. All images have set build Action &gt; content. Now every time when run project from xamarin studio i get GdxRuntimeException Coldn&#8217;t load file: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6909","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6909","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6909"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6909\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}