fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design

Home Page:https://fyne.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android packaging fails: could not determine kind of name for C.ALooper_pollAll

TimidFuzz opened this issue · comments

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

Command: fyne package -os android -appID com.example.test
Output:

go build -buildmode=c-shared -o /tmp/fyne-work-1596608702/lib/armeabi-v7a/libtest.so test failed: exit status 1
# fyne.io/fyne/v2/internal/driver/mobile/app
../../go/pkg/mod/fyne.io/fyne/v2@v2.4.5/internal/driver/mobile/app/android.go:520:6: could not determine kind of name for C.ALooper_pollAll

How to reproduce

  1. Install android ndk
  2. Copy the code & install fyne
  3. Export the environment variable export ANDROID_NDK_HOME=~/Android/Sdk/ndk/27.0.11718014/
  4. Package for android using fyne package -os android -appID com.example.test

Screenshots

No response

Example code

package main

import (
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.New()
	w := a.NewWindow("test")

	content := widget.NewLabel("Hello world!")

	w.SetContent(content)

	w.ShowAndRun()
}

Fyne version

v2.4.5

Go compiler version

1.22.0

Operating system and version

Manjaro linux

Additional Information

This seems to affect only the latest versions of the ndk. Using r20b fixes the issue.

I faced the same problem and have not found the solution yet, but it seems that C.ALooper_pollAll was deleted in android api 34 as stated here.

Using an older version of the ndk solves the problem for me (e.g r20b)

commented

I solved it by going to the error (

if C.ALooper_pollAll(-1, nil, nil, nil) == C.ALOOPER_POLL_WAKE {
) and removing the condition
image

Hello. I was able to solve this issue replacing the C.ALooper_pollAll() with C.ALooper_pollOnce where the error was called at ../../go/pkg/mod/fyne.io/fyne/v2@v2.4.5/internal/driver/mobile/app/android.go:520:6:

image

I found the solution here https://developer.android.com/ndk/reference/group/looper

image

I hope this helps

Suggested fix resolves the issue

I landed that change on to develop thanks for the tip