android-client icon indicating copy to clipboard operation
android-client copied to clipboard

[Question] Java Edition client design blueprint

Open Cikaros opened this issue 7 months ago • 9 comments

Since the Android version client updates slowly, I found that the clone Java branch is still in development (features are not fully implemented). Do you have any design documents for this version of the client? It would help me better work on the PR. @pappz

Cikaros avatar May 06 '25 06:05 Cikaros

Hello @Cikaros ,

Do you have the motivation to contribute to our project? That would be awesome!

In the original project, the UI was implemented in React Native. However, it has become difficult to maintain, so we’ve decided to move forward without it. In the first stage, we’re focusing on porting the current existing features to Java.

At the moment, I’m working on the "main" fragment in the java-home-ui branch. What's still completely missing are the "Advanced" and "Change Server" menus.

If you are interested in the project I can give you some instructions on how you can catch up the dev state.

pappz avatar May 14 '25 12:05 pappz

I am very interested, but my time is quite scattered and I cannot engage in long-term online development work for the android-client. If you don't mind, I can contribute to the project.

Cikaros avatar May 14 '25 12:05 Cikaros

I'm reading your java branch, but I lack the knowledge of combining gomobile and Android, so I'm looking for information.

Cikaros avatar May 20 '25 07:05 Cikaros

What is the implementation idea of [Change Server]? Can you guide me to realize the idea?

Cikaros avatar May 20 '25 08:05 Cikaros

The following errors were found during the debugging process:

2025-05-23 14:24:46.781 26389-26448 GoLog                   io.netbird.client                    E  [INFO] client/iface/iface.go:229 interface tun0 has been removed
2025-05-23 14:24:47.284 26389-26453 GoLog                   io.netbird.client                    E  [ERRO] client/internal/connect.go:277 error while starting Netbird Connection Engine: enable server router: server route not supported on this os

This is packaged using build-android-lib.sh, and some parameters have been adjusted.

#!/bin/bash
# Script to build NetBird mobile bindings using gomobile
# Usage: ./script.sh [version]
# If no version is provided, "development" is used as default
set -e
export ANDROID_NDK_HOME=/Users/cikaros/Library/Android/sdk/ndk/29.0.13113456
# Set version from the first argument or use "development" as default
version=${1:-development}
app_path=$(pwd)

cd netbird
gomobile init

CGO_ENABLED=0 gomobile bind \
  -androidapi=26 \
  -o $app_path/gomobile/netbird.aar \
  -javapkg=io.netbird.gomobile \
  -ldflags="-X golang.zx2c4.com/wireguard/ipc.socketDirectory=/data/data/io.netbird.client/cache/wireguard -X github.com/netbirdio/netbird/version.version=$version" \
  $(pwd)/client/android

cd - > /dev/null

Cikaros avatar May 23 '25 06:05 Cikaros

The following errors were found during the debugging process:

2025-05-23 14:24:46.781 26389-26448 GoLog                   io.netbird.client                    E  [INFO] client/iface/iface.go:229 interface tun0 has been removed
2025-05-23 14:24:47.284 26389-26453 GoLog                   io.netbird.client                    E  [ERRO] client/internal/connect.go:277 error while starting Netbird Connection Engine: enable server router: server route not supported on this os

This is packaged using build-android-lib.sh, and some parameters have been adjusted.

#!/bin/bash
# Script to build NetBird mobile bindings using gomobile
# Usage: ./script.sh [version]
# If no version is provided, "development" is used as default
set -e
export ANDROID_NDK_HOME=/Users/cikaros/Library/Android/sdk/ndk/29.0.13113456
# Set version from the first argument or use "development" as default
version=${1:-development}
app_path=$(pwd)

cd netbird
gomobile init

CGO_ENABLED=0 gomobile bind \
  -androidapi=26 \
  -o $app_path/gomobile/netbird.aar \
  -javapkg=io.netbird.gomobile \
  -ldflags="-X golang.zx2c4.com/wireguard/ipc.socketDirectory=/data/data/io.netbird.client/cache/wireguard -X github.com/netbirdio/netbird/version.version=$version" \
  $(pwd)/client/android

cd - > /dev/null

I think you can modify this file or disable firewall for android client

Image

Image

tienthanh2509 avatar May 23 '25 07:05 tienthanh2509

The initial understanding is that the Android system does not support Router. The firewall you mentioned, I have not found how to disable it.

Cikaros avatar May 26 '25 01:05 Cikaros

I ignored a very important WARN:

[WARN] client/firewall/uspfilter/localip.go:136 failed to get interfaces: route ip+net: netlinkrib: permission denied

I think it should be the culprit.

Cikaros avatar May 26 '25 09:05 Cikaros

I ignored a very important WARN:

[WARN] client/firewall/uspfilter/localip.go:136 failed to get interfaces: route ip+net: netlinkrib: permission denied

I think it should be the culprit.

The branch is ready for review. It points to a submodule, don't forget to check out the committed version. After that, just run ./build-android-lib.sh, and the repo will be ready to build the Android code. Could you double-check how it operates?

pappz avatar May 28 '25 15:05 pappz