Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android not working? #720

Open
thomasuster opened this issue Sep 6, 2023 · 9 comments
Open

Android not working? #720

thomasuster opened this issue Sep 6, 2023 · 9 comments

Comments

@thomasuster
Copy link
Member

cd DisplayingABitmap
haxelib run nme build android -toolkit -gradle

Expected: Should build
Result:

Error: project/src/audio/OpenSlSound.cpp:405:7: error: use of undeclared identifier 'HxAtomicDec'
      HxAtomicDec(&activeBuffers);
      ^
project/src/audio/OpenSlSound.cpp:411:7: error: use of undeclared identifier 'HxAtomicInc'
      HxAtomicInc(&activeBuffers);
      ^
project/src/audio/OpenSlSound.cpp:675:7: error: use of undeclared identifier 'HxAtomicDec'
      HxAtomicDec(&activeBuffers);
      ^
3 errors generated.

Using:
HXCPP: HaxeFoundation/hxcpp@298ad2d
Haxe: 4.3.2

@slabgames
Copy link

slabgames commented Nov 13, 2023

It seems like duplicate issue with the one in here : #715
does it mean, NME doesn't run on Android at the moment? It has been almost a year since the issue was reported

@hughsando
Copy link
Member

Looks like hxcpp atomic code has been updated, but the android case has been ignored.
Will need a fix in hxcpp.

@slabgames
Copy link

Is there a temporary workaround for this? @hughsando

@Apprentice-Alchemist
Copy link

Use of HxAtomicInc needs to be replaced with _hx_atomic_add.
and use of HxAtomicDec with _hx_atomic_sub.

The new atomic functions are declared in hx/StdLibs.h (https://github.com/HaxeFoundation/hxcpp/blob/45ee673796438ea5e8e57cb9ee4b7f47ea47d213/include/hx/StdLibs.h#L351).

This was indeed caused by HaxeFoundation/hxcpp#985 and it is not an Android-specific issue, the old atomic functions are gone on all targets.
I suppose I should have known better than to expect hxcpp to be the only consumer of these functions.

@thomasuster
Copy link
Member Author

Thanks @Apprentice-Alchemist I can get it building now.

@hughsando Any ideas for how to fix this crash I'm getting on startup?

See stacktrace in #722 description.

@hughsando
Copy link
Member

I have put in some android changes I have been sitting on because of lack of proper testing. But see how they go.

@hughsando
Copy link
Member

The stack trace is showing "neon" which is not available on the simulator (it is ARM only), so there is something off with the #defines. In OGLTexture I added ANDROID_SIM, but it might need to be put in a few more places.

@thomasuster
Copy link
Member Author

thomasuster commented Jan 28, 2024

Hmmm, got DisplayingABitmap building and running using your latest changes with one minor change (below), but getting the same runtime error with png_do_expand_palette_rgb8_neon. Which seems to be some function inside libpng? Took a look at OGLTexture, but not sure how to modify the defines to get it working.

diff --git a/templates/android/PROJ-gradle/app/src/main/AndroidManifest.xml b/templates/android/PROJ-gradle/app/src/main/AndroidManifest.xml
index 7a3dc7eb..fbb8989a 100644
--- a/templates/android/PROJ-gradle/app/src/main/AndroidManifest.xml
+++ b/templates/android/PROJ-gradle/app/src/main/AndroidManifest.xml
@@ -17,7 +17,7 @@
    <application
        android:label="::APP_TITLE::"
        ::if (DEBUGGABLE):: android:debuggable="true" ::end::
-       ::if (HAS_ICON):: android:icon="@mipmap/icon"::end::
+       ::if (HAS_ICON):: android:icon="@drawable/icon"::end::
        ::if (HAS_BANNER):: android:banner="@drawable/banner"::end::
        ::foreach appHeader:: ::__current__:: ::end::
    >

@thomasuster
Copy link
Member Author

@hughsando This seems to fix it. Request for review, native-toolkit/libpng#3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants