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
x/mobile: Calling net.InterfaceAddrs() fails on Android SDK 30 #40569
Comments
/cc @hyangah |
Any more updates on this one? Android 11 was released today. |
Reproduced in Yggdrasil project for net.Interfaces(): |
Any updates? |
I'd also love an update, if possible. This is blocking a project of mine right now. |
Anybody looking into this? |
Seems to be caused by these new restrictions in Android 11:
https://developer.android.com/training/articles/user-data-ids#mac-11-plus |
https://developer.android.com/distribute/best-practices/develop/target-sdk In August 2021, new apps in the Google Play Store will be required to target API level 30. |
Any updates on this one? This fix did not work for us: Catfriend1/syncthing-android#800 |
Hello golang dev team, any update on this issue? This is blocking the Android 11 compatibility of my app :/. Thanks! |
We ended up developing an alternative using Android APIs, which we call instead of getInterfaceAddrs(). |
Great, will take a look and see if I can circumvent my issue with this . Thanks!
Sent from myMail for iOS
Thursday, 9 December 2021 14:39 -0600 from ***@***.*** ***@***.***>:
…We ended up developing an alternative using Android APIs, which we call instead of getInterfaceAddrs().
tailscale/tailscale-android#21
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub , or unsubscribe .
Triage notifications on the go with GitHub Mobile for iOS or Android .
|
Yes, this problem exists since Android 11, if you need help, you can contact me. |
@wlynxg Hi, I've seen this PR hanging for a long time, is it has any progress now? Thanks! |
The current main problem is that you cannot get the Android version number directly through go. However, you can tell go the Android version number by calling the go function on Android. There are no other problems for the time being. |
Is the background that you want to use the Andoird version instead of os.IsPermission as a fallback? |
yeah |
@wlynxg |
I fixed this problem in a later update and used |
Sorry, my mistake. So what exactly is the problem? It looks like it can be merged now from my perspective. |
Hi @wlynxg, thanks for the offer. Well, I see the changes linked above, but I wouldn't know how to apply them. I generally know how to apply a PR, but in this scenario I'm just a GOMOBILE user under Android, and my GOLANG is maybe three days old or so :) I basically don't know, where to apply the change. |
The official has not accepted this change for the time being. My suggestion is to temporarily use a third-party library on the Android platform instead of the net package to obtain network card information. You can refer to my code: https://github.com/wlynxg/anet. |
@wlynxg Thanks, did that right now. My problem is, I'm using EDIT: But even if you support that, I'm sure it is not my code which provokes that problem. It is the LiveKit SDKs problem, which most likely also uses |
If you can provide relevant code, I can help you analyze it. |
Well, yes. I'm just calling |
There are still unaddressed review comments which might explain why the PR has stalled. https://go-review.googlesource.com/c/go/+/507415/3/src/syscall/netlink_linux.go https://go-review.googlesource.com/c/go/+/507415/3/src/net/interface_linux.go |
I'm having a question: This problem is open since 2020. There is no workaround. Basically it means, that all Android apps, relying on GO in some way and "doing network things", will not work if they are running Android 11 or higher (at least the latter is for sure not that exotic anymore as it was in 2020) I'm wondering why this issue is not making bigger waves, but most likely the relevance of gomobile for Android is lower than expected (which is kind of a pity, since it is in some limited ways a perfect replacement of C++). But at least network things should be working. |
Same suffering here. 4 years old bug, unbelievable! Findings, while using same gomobile arr in Android App,
Is there any workaround available, even only with targetSdkVersion 29? |
@invented-pro At least for me it is solved. Apply this PR to a source installation of GOLANG #61089 |
I'll take a try. Thanks @neilyoung |
@wlynxg what's the current state of the PR? |
Merging is blocked for some reasons. |
src + PR build on macos failed due to some tests. |
@invented-pro I'm on macOS 14.2.1, M1 |
cannot build on 14.2.1 M2 |
I had a recent binary installation on disk, then followed this gist https://go.dev/doc/install/source. Applied the patch manually. Made the patched GOLANG default then. EDIT: Aarggh.... Realized right now, that I did it on Ubuntu 20.04. Sorry for this... |
Thanks. I'll try on linux. |
I built golang from src patched with PR61089, then used it to build aar file, finally it works as expected now on Android11 & 13, no "netlinkrib: permission denied" anymore. Sincerely thank @wlynxg for the PR !!! Thank @neilyoung for guidance!!! Hints to whom it may concern:
|
@invented-pro Thanks for letting me know. Yes, this PR is really worth to be merged finally. Thanks also for the extra information, even though I cannot confirm your last issue. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Calling
net.InterfaceAddrs()
fails on Android app targetting SDK version 30. Withbuild.gradle
looking like:Building the exact same app targetting SDK 29 works, and returns no error:
What did you expect to see?
Targetting SDK 30 would behave no differently.
What did you see instead?
Calling
net.InterfaceAddrs()
results in errorroute ip+net: netlinkrib: permission denied
when embedded in Android app targetting SDK 30 (R):The text was updated successfully, but these errors were encountered: