Step 0 Download Google Android Studio
https://developer.android.com/studio
Code:
ls ~/Downloads | grep .tar
\
android-studio-panda2-linux.tar.gz
Step 1 Linux Compatibility Requirement
I am not going to show how to get a compat up and running there's plenty of options... I use debian as that's what Android-Studio suggest I have Debian Trixie
Code:
vi /etc/rc.conf
\
linux_enable="YES"
ls /compat/linux
\
#chroot /compat/linux /bin/bash
#\
sudo chroot /compat/linux /bin/bash
\
Step 2 Extract the Files .tar in Linux Compat
Code:
sudo mv ~/Downloads/android-studio-panda2-linux.tar.gz /compat/linux/root/Downloads
Code:
sudo ls /compat/linux/root/Downloads
\
android-studio-panda2-linux.tar.gz
Code:
sudo chroot /compat/linux /bin/bash
\
cd /root/Downloads/
\
tar -zxvf ~/Downloads/android-studio-*-linux.tar.gz
\
android-studio/
android-studio/modules/
android-studio/modules/module-descriptors.dat
android-studio/modules/module-descriptors.jar
android-studio/product-info.json
android-studio/plugins/
android-studio/plugins/c/
android-studio/plugins/c/lib/
android-studio/plugins/c/lib/modules/
android-studio/plugins/c/lib/modules/intellij.c.core.jar
android-studio/plugins/c/lib/modules/intellij.c.debugger.jar
android-studio/plugins/c/lib/modules/intellij.c.testing.jar
android-studio/plugins/c/lib/modules/intellij.cidr.modulemap.language.jar
android-studio/plugins/c/lib/c.jar
android-studio/plugins/c/lib/LICENSE.txt
android-studio/plugins/vcs-gitlab/
android-studio/plugins/vcs-gitlab/lib/
android-studio/plugins/vcs-gitlab/lib/modules/
android-studio/plugins/vcs-gitlab/lib/modules/intellij.vcs.gitlab.yaml.jar
android-studio/plugins/vcs-gitlab/lib/modules/intellij.vcs.gitlab.git.jar
android-studio/plugins/vcs-gitlab/lib/vcs-gitlab.jar
android-studio/plugins/Kotlin/
android-studio/plugins/Kotlin/lib/
android-studio/plugins/Kotlin/lib/kotlinc.sam-with-receiver-compiler-plugin.jar
android-studio/plugins/Kotlin/lib/kotlinc.kotlin-compiler-fe10.jar
android-studio/plugins/Kotlin/lib/kotlin-plugin.jar
android-studio/plugins/Kotlin/lib/ehcache.sizeof.jar
android-studio/plugins/Kotlin/lib/kotlinc.compose-compiler-plugin.jar
android-studio/plugins/Kotlin/lib/kotlin-base-jps.jar
android-studio/plugins/Kotlin/lib/vavr.jar
android-studio/plugins/Kotlin/lib/kotlinc.kotlin-dataframe-compiler-plugin.jar
android-studio/plugins/Kotlin/lib/kotlinc.kotlin-compiler-ir.jar
android-studio/plugins/Kotlin/lib/kotlin-plugin-shared.jar
android-studio/plugins/Kotlin/lib/kotlinc.noarg-compiler-plugin.jar
android-studio/plugins/Kotlin/lib/kotlinc.kotlin-jps-common.jar
android-studio/plugins/Kotlin/lib/kotlinc.scripting-compiler-plugin.jar
android-studio/plugins/Kotlin/lib/kotlin-gradle-tooling.jar
android-studio/plugins/Kotlin/lib/kotlinc.allopen-compiler-plugin.jar
android-studio/plugins/Kotlin/lib/completion-ranking-kotlin.jar
android-studio/plugins/Kotlin/lib/kotlinc.js-plain-objects-compiler-plugin.jar
....
android-studio/jbr/legal/jdk.compiler/ASSEMBLY_EXCEPTION
android-studio/jbr/conf/
android-studio/jbr/conf/sound.properties
android-studio/jbr/conf/jaxp.properties
android-studio/jbr/conf/sdp/
android-studio/jbr/conf/sdp/sdp.conf.template
android-studio/jbr/conf/logging.properties
android-studio/jbr/conf/security/
android-studio/jbr/conf/security/java.policy
android-studio/jbr/conf/security/java.security
android-studio/jbr/conf/security/policy/
android-studio/jbr/conf/security/policy/README.txt
android-studio/jbr/conf/security/policy/unlimited/
android-studio/jbr/conf/security/policy/unlimited/default_US_export.policy
android-studio/jbr/conf/security/policy/unlimited/default_local.policy
android-studio/jbr/conf/security/policy/limited/
android-studio/jbr/conf/security/policy/limited/default_US_export.policy
android-studio/jbr/conf/security/policy/limited/default_local.policy
android-studio/jbr/conf/security/policy/limited/exempt_local.policy
android-studio/jbr/conf/management/
android-studio/jbr/conf/management/jmxremote.access
android-studio/jbr/conf/management/jmxremote.password.template
android-studio/jbr/conf/management/management.properties
android-studio/jbr/conf/net.properties
Code:
mv /root/Downloads/android-studio /usr/local/
\
#chown -R $USER:$USER /usr/local/android-studio
Code:
ls /usr/local/android-studio
\
Install-Linux-tar.txt NOTICE.txt build.txt lib modules product-info.json
LICENSE.txt bin jbr license plugins
Step 3 Need to install dependencies
Code:
sudo chroot /compat/linux /bin/bash
\
apt update
\
apt upgrade
\
apt install libxtst6 libxrender1 libxi6 libfontconfig1 libxext6
\
apt install libgtk-3-0 libxss1 libasound2 libdbus-1-3
\
Step 4 Android-Studio X11 pass
"Can't connect to X11 window server." This happens because your Debian chroot is isolated and cannot "see" the X11 Unix socket used by FreeBSD.
Code:
sudo chroot /compat/linux /bin/bash
\
mkdir -p /tmp/.X11-unix
\
In gateway or FBSD not in COMPAT
Code:
sudo mount -t nullfs /tmp/.X11-unix /compat/linux/tmp/.X11-unix
\
xhost +local:
\
xhost
\
access control enabled, only authorized clients can connect
LOCAL:
Step 5 Fix KVM error install Qemu
This does not work on FBSD don't even try...
Step 6 Connect via USB device
You need this in gateway FBSD if you want to use your android device.
Code:
pkg install android-tools
\
Step 7 Android-studio has ABD-script build in.
ABD in the Android-Studio is different from ADB in FBSD pkg so you cannot even use.
Code:
sudo chroot /compat/linux /bin/bash
\
mv ~/Android/Sdk/platform-tools/adb ~/Android/Sdk/platform-tools/adb.original
\
Code:
sudo chroot /compat/linux /bin/bash
\
cat > ~/Android/Sdk/platform-tools/adb << 'WRAPPER'
#!/bin/sh
REAL_ADB="/root/Android/Sdk/platform-tools/adb.original"
case "$1" in
kill-server)
# Silently ignore
exit 0
;;
start-server)
# Pretend it worked
echo "* daemon already running on port 5037"
exit 0
;;
server)
# Block any attempt to start a new server daemon
echo "* daemon already running on port 5037"
exit 0
;;
fork-server)
# Block fork-server too
echo "* daemon already running on port 5037"
exit 0
;;
*)
# For everything else (devices, version, push, pull, shell, etc.)
# Use the Linux binary as a CLIENT ONLY connecting to the FreeBSD server
export ADB_SERVER_SOCKET=tcp:127.0.0.1:5037
export ANDROID_ADB_SERVER_PORT=5037
exec "$REAL_ADB" "$@"
;;
esac
WRAPPER
Step 8 Getting ADB working FBSD so I can plug my android instead of emulated device
Short story the abd that is in pkg doesn't have network requirement to pick IPv4 which implies it default to ipv6.... Anyways you need to do a hacker work around or compile from port with custom plugin which I did not so I used socat
Code:
adb -a -P 5038 server nodaemon &
\
socat TCP4-LISTEN:5037,bind=127.0.0.1,reuseaddr,fork 'TCP6:[::1]:5038' &
\
#AFTER above plug device and do this command#
adb devices
\
List of devices attached
85drf69c555f9ece device
Now the issue is that to pass the ADB to the Android-studio directly you need to do some custom config BEFORE you launch the studio.sh.
Code:
sudo chroot /compat/linux /bin/bash
\
#YOU should see the same device as in FBSD (if not Android-studio doesn't see it)
env ADB_SERVER_SOCKET=tcp:127.0.0.1:5037 /root/Android/Sdk/platform-tools/adb devices
\
List of devices attached
85drf69c555f9ece device
env ADB_SERVER_SOCKET=tcp:127.0.0.1:5037 ANDROID_ADB_SERVER_ADDRESS=127.0.0.1 ANDROID_ADB_SERVER_PORT=5037 /usr/local/android-studio/bin/studio.sh
\
Working environment for development you should see in your X11 environment. IF YOU DO NOT pass the /tmp/.X11 to /compat you will not see the GUI.