URLLoader Can't work on Android

I have an Android app that I’ve written in Haxe that uses URLLoader, URLRequest to fetch the JSON for an array.

When I compile the app to Flash it runs fine and gets the JSON string from the webserver no problem.

When I compile to Android and install it on my phone, it never contacts the webserver.

Please Help me for this case :frowning:

What version of OpenFL?

I’m Using

  • Openfl 3.x
  • Flashdevelop for compile

I Tried library from https://github.com/yupswing/akifox-asynchttp
but it still not work on android.

Looks like an ANDROID permission issue to me.
Are you sure you allowed your android app to perform internet call in your manifest file?

OpenFL includes the INTERNET permission by default.

However, if you set a custom permission, all of the defaults are thrown out. For instance, if you add this line to project.xml, suddenly you won’t have the INTERNET permission:

<config:android permission="com.android.vending.BILLING" />

Fortunately, it isn’t hard to get the permission back:

<config:android permission="com.android.vending.BILLING" />
<config:android permission="android.permission.INTERNET" />

Even if I set my AndroidManifest.xml file or set permission, game compiles with some kind of default AndroidManifest.xml and only have these two permissions:

There is manifest-merger-debug-report.txt, where it somehow decide to not use permissions I provide, why?

ADDED from …\bin\android\debug\bin\app\src\main\AndroidManifest.xml:7:2-78
ADDED from …bin\android\debug\bin\app\src\main\AndroidManifest.xml:8:2-77

It’s getting those two permissions from your app’s main AndroidManifest.xml file. This means you’re failing to overwrite that file.

Can you post the <template /> tag you’re using?

<template path="AndroidManifest.xml" />

My Androidmanifest.xml has only
<uses-permission android:name="android.permission.INTERNET" />

I also tried adding this with no luck:
<config:android permission="android.permission.INTERNET" />

The manifest file moved in the Gradle update. Now you’ll want to use this:

<template path="AndroidManifest.xml" rename="app/src/main/AndroidManifest.xml" />

Are you using a library that overrides AndroidManifest.xml? To check, look through the include.xml file for any <template /> tags.

If so, you might want to notify that library’s owner that they’re doing it wrong. They should use the <dependency /> tag to register a dependency folder. If they put their AndroidManifest.xml file in this folder, it will be used in addition to your personal manifest, rather than replacing yours.


That did the trick.
Thank you Joseph!

Hi i have the same problem when my app tried to used urlLoader it crash…
I alreddy have the INTERNET permission in the project … what can be happening with my app ?