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 support #242

Merged
merged 11 commits into from
Jul 6, 2021
Merged

Android support #242

merged 11 commits into from
Jul 6, 2021

Conversation

JBou
Copy link
Contributor

@JBou JBou commented Mar 30, 2021

This PR builds and packs a .aar library for Android that contains native libraries for the currently supported ABIs. An .aar library is like a .jar library, specifically for Android, that also supports native-libraries. More on the aar file structure here.

I also added a GitHub workflow as example to build the library. A sample workflow run and the resulting .aar library attached as artifact can be found here.

The minimum Android API level is 21. It's tied to the minAPI of quiche.
Note that on API 21-23 you have to enable Java 8+ API desugaring support, otherwise the app will crash, it won't find a lambda class. On Android API Level >=24, Java 8 features used in netty-incubator-codec-quic (like lambdas) are supported and it's working without enabling desugaring.

I made a sample application here to test this out. It includes the sample server and client code from the example package and a simple Android client.
Currently, when sending messages from the Android client to the server works perfectly fine, but when receiving messages from the server on the Android client the app crashes with a native exception. The GitHub issue can be found here. It needs to be fixed to make this implementation work, but currently I don't know if the problem is caused by netty or quiche or some android specific problem. I would kindly ask your help to solve it, because I'm new to C/native programming and still had a lot to learn and fix to make this library cross-compile for Android.

I changed the library name on Android to netty_quiche.so, because most of the times an Android phone supports multiple architectures and falls back to other architectures, so the name needs to be the same. Secondly, I needed to change it because the PlatformDependent class returned netty_quiche_linux_aarch_64 on Android.

We should check if the extraCflags, extraCxxflags, cmakeAsmFlags, cmakeCFlags, cmakeCxxFlags, cflags, extraLdflags are correct. I'm not quite familiar with the flags.

I'm looking forward to fix this crash and make this PR work. I'm sure there are still some things to change before merging this, just let me know.
Making QUIC available as transport protocol for Netty on Android would be a great step forward, especially because it has some great features that are useful on mobile networks and mobile devices (such as connection migration, ...). Thanks for all of your hard work on this framework and I hope I can contribute something back to the community with this addition.

@normanmaurer
Copy link
Member

@JBou can you please rebase on latest main branch ?

@JBou
Copy link
Contributor Author

JBou commented Apr 27, 2021

Yes, I will do it tonight 👍 Have you seen the changes I requested on #249?

@normanmaurer
Copy link
Member

@JBou no there are no comments on the PR... hmm. Can you open a PR with the requested changes ?

@JBou
Copy link
Contributor Author

JBou commented Apr 27, 2021

Oh, now that's strange. The reviews are still there but are only being shown when I'm logged in. It might be that I left the browser-tab open over night and there is a bug with GitHub and my session. Really strange 🤔
Nevertheless, I will open a PR right now with the requested changes.

image

@normanmaurer
Copy link
Member

@JBou ok lets rebase now

@JBou
Copy link
Contributor Author

JBou commented Apr 29, 2021

I rebased yesterday

@JBou
Copy link
Contributor Author

JBou commented May 5, 2021

@normanmaurer do you have some time to review the rest of this PR?

@normanmaurer
Copy link
Member

@JBou yep I will do it this week.

@normanmaurer
Copy link
Member

@JBou sorry but I need to ask you one last time to rebase :/

@JBou
Copy link
Contributor Author

JBou commented Jun 23, 2021

I rebased again 👍

@normanmaurer normanmaurer added this to the 0.0.16.Final milestone Jul 6, 2021
@normanmaurer normanmaurer merged commit 7f1759f into netty:main Jul 6, 2021
@normanmaurer
Copy link
Member

@JBou thanks a lot!

@JBou
Copy link
Contributor Author

JBou commented Jul 10, 2021

Awesome, thanks for merging!

normanmaurer added a commit that referenced this pull request Jul 22, 2021
normanmaurer added a commit that referenced this pull request Jul 28, 2021
@JBou JBou deleted the android branch July 19, 2023 05:37
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

Successfully merging this pull request may close these issues.

None yet

2 participants