-
Notifications
You must be signed in to change notification settings - Fork 79
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
NativeActivity.AssetManager is nil #6
Comments
Hi, by default all struct wrappers hold reference to the original struct, fields are not copied. a := app.NativeActivity.NativeActivity()
a.Deref()
// ... access fields |
Thanks. I missed the Defer. However I am still having problems with the AssetManager. Maybe I misunderstood the rather sparse NDK docs. As soon as I get the app.onCreate event I do this:
I have verified that the apk contains "/assets/textures/textures.txt". The output I get is:
A bit of background: As you can see from the stack trace, this code is in a function ( Btw. I think it would be great if the app package had something like |
Safe strings are disabled for this package, that means the strings you pass to binding should be Try this: var asset = android.AssetManagerOpen(activity.AssetManager, "textures/textures.txt\x00", android.AssetModeStreaming)
I agree, it could also automatically add |
Since #7 is merged, I'll close this issue. |
@MaVo159 I refactored the function to avoid unnecessary Go memory references into C, added mutex for activity-related operations, etc. Please check with 3a14af7 Thanks for bringing that issue. |
The AssetManager field of the android.NativeActivity returned by app.NativeActivity.NativeActivity() is nil.
I'm building for API 24 with:
export CGO_CFLAGS="-march=armv7-a"
export GOOS=android
export GOARCH=arm
export GOARM=7
The device is a Pixel XL
The text was updated successfully, but these errors were encountered: