Android -Dlegacy troubles

Just got through setting up Android building for my first time ever. Managed to get the app to build for the emulator, but unfortunately, it crashes when running.

Total time: 12 seconds
Starting AVD: AVD_for_Galaxy_Nexus_by_Google
/system/bin/sh: can't create C:UsersDriklynAppDataLocalTemp/temp_229539: No such
 file or directory
1674 KB/s (6587531 bytes in 3.842s)
Error: Could not access the Package Manager.  Is the system running?
Error type 2
android.util.AndroidException: Can't connect to activity manager; is the system
        at Method)
        at dalvik.system.NativeStart.main(Native Method)

Looks like it’s trying to create some temp file but is missing the slashes in the directory structure: C:UsersDriklynAppDataLocalTemp/temp_229539

Running OpenFL 3.0.2.

Also, had to fix one issue to get building correctly. The parameter is named inWhich here, but is referenced as which in the method itself. Need to rename either one so that they match each other.

Thanks for any help!

This seems like a bug in the Android tools, but it’s possible we could work around it.

If you’re open to rebuilding the Lime tools (using lime rebuild tools), try editing “lime/lime/tools/helpers/AndroidHelper.hx” and going to about line 296. There’s a line where it gets "tempFile` then uses this in an ADB call.

You could try:

Sys.println ("Hello: " + tempFile);

Then rebuild and see if this is the same path. If it is (and does have slashes) then perhaps we can replace the slashes or do some other modification to the text in order to ensure that ADB handles it properly

Thanks was the suggestion. Was about to try it, but haxelib was down for a few hours at the time and I couldn’t download the required format library, so I started toying around while I waited…

Ended up upgrading the Android build tools to the latest (side note: I found the documentation to be very confusing / lacking as to which versions of what you should have installed), which seemed to solve the missing slashes issue, though I still get the “can’t create: no such file or directory” error, only now it has proper slashes, like below:

/system/bin/sh: can't create C:\Users\Driklyn\AppData\Local\Temp/temp_8197668: No such file or directory

However, I was able to successfully run the app regardless of the error, everything is just really small.

I am using the new Samsung Galaxy S6 as my device which has a 1440x2560 resolution and although I have the window size set to 256x256 in the project.xml file, it is rendering at 1440x2560 regardless.

I tried messing around with StageScaleMode and setting fullscreen to true, but nothing seemed to change much of anything. Some settings just appeared to have change the center position, but that’s about it. The size is still at 1440x2560, which I confirmed by drawing a 720x1280 white rectangle to the screen and saw that it filled the top-left quadrant of the screen perfectly.

Also, how do I obtain the path to the assets folder? I tried using SystemPath.applicationDirectory, but it gives me an Invalid directory error when trying to read the directory contents (the path it gives me is /data/app/

I’m wondering if perhaps my app doesn’t have read/write permissions or something?? Not sure…

For future reference, these are the packages I currently have installed:

  • Android SDK Tools: 24.1.2
  • Android SDK Platform-tools: 22
  • Android SDK Build-tools: 22.0.1
  • Android 4.1.2 (API 16 rev 5)

Since I wrote the “setup” command for Android (years ago) they added the “build tools” package, separate from “platform tools”, in general, use the latest available for all of those.

You are using -Dlegacy? I thought it would add letterboxing to projects

If “base.apk” is the returned path (I think that’s right?) it’s zipped – the application on Android remains inside of a ZIP, so you need to use the Assets system in order to extract assets which are still zipped inside your project