Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Ches_V_
Beginner
110 Views

Path Error for Launch Icons

Hi!

I am using Intel XDK 3759 and I have a problem when trying to set a Launch Icon:

When I import a Launch Icon (from the package-assets folder that is automatically created) the path of the file is set to www/D/myfolder/package-assets/launcherxhdpi.png, which does not extist (the correct path would be D/myfolder/package-assets/launcherxhdpi.png, without www/ at the beginning).

I already tried changing in the .xdk (while the Intel XDK was closed)

"relPath": "/D/myfolder/package-assets/launcherxhdpi.png"

to

"relPath": "/package-assets/launcherxhdpi.png"

and creating a package-assets folder in www that contains the launcherxdpi.png file. If I do this, when I reopen the Intel XDK I cannot open the project, an error message pops up saying that Project Files couldn't be found.

Any clue? Thank you!

Tags (2)
0 Kudos
14 Replies
PaulF_IntelCorp
Employee
110 Views

Try this:

"relPath": "package-assets/launcherxhdpi.png",

Note the removal of the '/' at the beginning of the path, it is a relative path, not an absolute path. It is relative to the root of your project folder, so it assumes the files are located in the "package-assets" folder that is located in the root of your project folder.

And make sure you do not forget the comma at the end (assuming it is not the last element in the object). The format of that file must be strict JSON or it will not be read in properly by the XDK.

Ches_V_
Beginner
110 Views

I still get the same error: 

The Intel XDK could not locate this project. Your project files may have been moved or deleted from your drive. You can remove this project from the Intel XDK or refresh your project list to remove all missing projects.

        
        "icons_": [
          {
            "density": "xhdpi",
            "relPath": "package-assets/launcherxhdpi.png",
            "width": 96,
            "height": 96
          },
          {
            "density": "hdpi",
            "relPath": "package-assets/launcherhdpi.png",
            "width": 72,
            "height": 72
          },
          {
            "density": "mdpi",
            "relPath": "package-assets/launchermdpi.png",
            "width": 48,
            "height": 48
          }
        ],

I still get the same error. It's also curious, whenever I reset the code to its original state, I keep getting the same message.

Ches_V_
Beginner
110 Views

Paul F. (Intel) wrote:

Note the removal of the '/' at the beginning of the path, it is a relative path, not an absolute path. It is relative to the root of your project folder, so it assumes the files are located in the "package-assets" folder that is located in the root of your project folder

I don't understand this. The problem is that "www" is automatically added at the beginning of the path, so "package-assets/launcherxhdpi.png" becomes "wwwpackage-assets/launcherxhdpi.png". This is the reason why I think I should keep the '/', this way the path becomes "www/package-assets/launcherxhdpi.png" and I create a package-assets folder in thw www folder, where my launcher icons are located.

PaulF_IntelCorp
Employee
110 Views

Ches:

  • remove the reference to all icons in your XDK file, by doing this:
    "icons_": [],
  • make sure there is a package-assets folder in the root of your project
  • move all your icons to that package-assets folder (in the root of your project, not inside your www folder)
  • use the icons UI section of the Projects tab to select the icons and add them

Once you've done that, you can close the XDK and inspect the <project-name>.xdk file to see what it did.

If you need to include some icons that are not presented in the icons UI section, use the additions.xml file (see the "hello cordova" example for some help with that).

Ches_V_
Beginner
110 Views

This way it didn't work, but I got it working using another way. Thank you for your help ^^

I have another quick question: I want to export a Construct 2 game that uses AJAX to request and post information to my http webserver. When I run the game on my computer (localhost) it works perfectly, but when I export it to Android, it doesn't execute the GET and POST actions (I think they are probably being blocked for security reasons). I guess I have to set the permissions for media in order to be able to use AJAX, am I right?

PaulF_IntelCorp
Employee
110 Views

Yes, you have to use the whitelist and, potentially, CSP rules to get the network domain access you need. Please see the docs > https://software.intel.com/en-us/xdk/docs/using-cordova-whitelist-rules-with-intel-xdk

Ches_V_
Beginner
110 Views

Hi!

I have a view questions about this tutorial https://software.intel.com/en-us/forums/intel-xdk/topic/607195

1.- In my game, screen orientation is by default portait, although it sometimes changes to landscape (e.g. when viewing a video). In the C2 Preview it works fine, but it does not work at all when I export my game via the Intel XDK. I already tried adding the Screen Orientation Plugin, but nothing has changed (what do I have to setup in order to be able to change screen orientation).

2.- In my game, there is an HTML with a Javascript import, which is executed by the browser. This HTML basically loads a web widget from an URL. On the XDK's simulator (localhost) it works fine, but it doesn't load in the exported version. Have you got any clue? I can send you a very basic Intel XDK Project so that you can see it if you didn't understand what I mean.

3.- Supporting multiple screen sizes: Is there any way to setup the game to automatically scale to the browser? I mean, if my window is 1080x1920 but the browser is 1000x1000, is there any way to adjust and size to this screen size (I don't mind if the aspect ratio isn't kept, I just want to fill the whole screen). I know there are better methods to support multiple screen sizes, but I just want my game to resize to the screen.

Thank you for your help :)

Best regards!

PaulF_IntelCorp
Employee
110 Views

Ches V. wrote:

1.- In my game, screen orientation is by default portait, although it sometimes changes to landscape (e.g. when viewing a video). In the C2 Preview it works fine, but it does not work at all when I export my game via the Intel XDK. I already tried adding the Screen Orientation Plugin, but nothing has changed (what do I have to setup in order to be able to change screen orientation).

I'm assuming you are referring to the behavior in the Simulate tab. You cannot control the orientation in the Simulate tab from your app. Likewise, you cannot control it in App Preview (Test tab). The only time you can control the orientation is in a built app. See the documentation for the screen orientation plugin for information regarding how to use it. Follow the links provided in the description of the plugin.

Screen Shot 2017-02-16 at 13.56.36 .png

Ches V. wrote:

2.- In my game, there is an HTML with a Javascript import, which is executed by the browser. This HTML basically loads a web widget from an URL. On the XDK's simulator (localhost) it works fine, but it doesn't load in the exported version. Have you got any clue? I can send you a very basic Intel XDK Project so that you can see it if you didn't understand what I mean.

I'm not sure what you mean by "the exported version." Do you mean in App Preview or a built APK or ??? If you mean a built app, you probably have a whitelist problem. Hover over the (i) link in the whitelist settings to find the documentation regarding whitelists.

Screen Shot 2017-02-16 at 13.59.57 .png

Ches V. wrote:

3.- Supporting multiple screen sizes: Is there any way to setup the game to automatically scale to the browser? I mean, if my window is 1080x1920 but the browser is 1000x1000, is there any way to adjust and size to this screen size (I don't mind if the aspect ratio isn't kept, I just want to fill the whole screen). I know there are better methods to support multiple screen sizes, but I just want my game to resize to the screen.

This is a question you should take to the web, it is outside the scope of this forum. We are dealing with Cordova apps here, for which there is no browser. If you need help with running apps in a browser on a desktop, I recommend you search places like Stack Overflow and HTML5rocks, etc.

Ches_V_
Beginner
110 Views

Paul F. (Intel) wrote:

Quote:

I'm assuming you are referring to the behavior in the Simulate tab. You cannot control the orientation in the Simulate tab from your app. Likewise, you cannot control it in App Preview (Test tab). The only time you can control the orientation is in a built app. See the documentation for the screen orientation plugin for information regarding how to use it. Follow the links provided in the description of the plugin.

It is in the built app where the screen orientation is blocked. I already read the Plugin documentation and I see I have to write code (which I don't know, this is the reason why I use Construct 2). I think I'm going to ask in the scirra forum wheter someone had the same problem and ask how he solved it.

Paul F. (Intel) wrote:

I'm not sure what you mean by "the exported version." Do you mean in App Preview or a built APK or ??? If you mean a built app, you probably have a whitelist problem. Hover over the (i) link in the whitelist settings to find the documentation regarding whitelists.

Sorry for my bad English ^^'. I mean, it doesn't work in the built app, while it works perfectly on the Simulator. I read all the tutorials on whitelists and I even allowed Intent, Navigation and Network Requests for all URLs (with *), but it still doesn't work in the built app. I think it is probably a very simple problem (I'm a noob ^^) but I don't know how to explain myself in English. Would you mind if I sent you a very very basic XDK Project so that you can easily see where the problem is?

Paul F. (Intel) wrote:

This is a question you should take to the web, it is outside the scope of this forum. We are dealing with Cordova apps here, for which there is no browser. If you need help with running apps in a browser on a desktop, I recommend you search places like Stack Overflow and HTML5rocks, etc.

Okay, thank you. And with Cordova apps? Is there any way to resize the game like this?ResizeScreen_0.jpg

Thank you once again for your help.

Best regards!

PaulF_IntelCorp
Employee
110 Views

Ches -- unfortunately, we are not experts on what you can and cannot do within the Construct2 environment to control things like orientation and size, but I would expect that environment would provide some sort of mechanism to control those variables and insure they are implemented properly when exported as a Cordova app. I do know that C2 does include the ability to use a collection of standard Cordova plugins, but I do not know if C2 requires that you write the code necessary to use those plugin APIs or if it provides that automatically. You'll have to use the C2 forums to figure out the answers to your first and last questions.

Regarding the middle question, which is possibly related to whitelist problems, it's hard to say what is happening. Again, I would first consult the Scirra forum. If you are doing all of this through the C2 environment, and not doing any hand coding, then I would expect whatever C2 tool you used to allow you to "load this web widget from a URL" should have some help on that forum. Sorry, but the description is quite vague and we have no knowledge of the internals of C2, so we do not know what this action really does, which means we really have no way to answer what is or is not happening. My response regarding the use of a whitelist was based on my intuition, not any detailed information, so it may be incorrect.

Ches_V_
Beginner
110 Views

Okay, I undesrtand it.

Thank you.

Ches_V_
Beginner
110 Views

About the middle question, I already know where is the problem:

I have an HTML object with a Javascript import and there is the problem (whitelists are fine). For any reason, the Javascript is only executed on localhost and it is not executed in the built APK (maybe it's a security reason?).

I have already thought an alternative way to load this HTML via AJAX (which is way more complicated and will cost me a lot of time) but I am 99% sure this will work (in the built APK). Please, let me know if there is any way to disable whatever it is that doesn't allow Javascripts to be executed in the built APK. If you still do not know what I am talking about (sorry once again for my bad English ^^') I will do the AJAX alternative.

Thank youn for your help.

Ches_V_
Beginner
110 Views

Please, only tell me if you know what it is that doesn't allow Javascripts to be executed in the built APK. If not, I can start to do the AJAX alternative, but I need to be sure because it is a lot of work.

Thank you.

PaulF_IntelCorp
Employee
110 Views

There is nothing that prevents JavaScript from executing in your built app, all JavaScript can be run. You may run into situations where some JavaScript code or HTML/CSS bits do not work the same in the built app as they do in the browser/simulate tab, but other than that, there is nothing that will "block" your JavaScript code. Trying to retrieve the external element is the most likely problem. Best way to debug this problem is to use remote CDT to debug what is actually happening in a built app. See these pages for help:

Reply