1. Instalare Android Studio
- instrucțiuni instalare în primul laborator
2. ADB
- comanda adb se regăsește acolo unde ați instalat SDK-ul, de exemplu la:
/opt/Android/SDK/platform-tools/adb
- trebuie activat modul developer telefon sau emulator
- avem nevoie de opțiunea "USB debugging"
- la comanda
adb shell
pe laptopul de dezvoltare, telefonul va afișa un prompt care cere permisiunea de conectare prin USB - adb funcționează peste cablul USB, sau peste WiFi dacă telefonul și laptopul sunt în aceeași rețea WiFi. Se recomandă setyupul inițial folosind cablul USB
2.1 USB setup
-
Dacă laptopul Linux nu vede telefonul la comanda
adb devices
2.2 adb over wifi
using Android Studio menus
- Din meniul de device-uri, se selectează "Pair Devices Using WiFi"
using wireless only
- phone and laptop must be on the same WiFi network, for example UPB-guest
- phone: in developer options/Quick settings developer tiles activate Wireless debugging
- phone: in Settings/about phone/Device identtifiers find IP address
- laptop:
adb mdns check
should answermdns daemon version [Openscreen discovery x.y.z]
- phone: Hold the tile to enter the menu and choose 'Pair device with pairing code'. IP:port is shown
- laptop:
adb mdns services
should see the IP:port exposed by the phone, for the service _adb-tls-connect._tcp - laptop:
adb pair IP:port
, enter the code displayed by the phone - laptop:
adb devices
now shows a device with a long name ending in '..._adb-tls-connect._tcp' - laptop:
adb shell
should give the prompt on the phone
- alternatively, for point 7 generate a QR code on the terminal and pair from the tile
using USB cable I
-
Connect the device and the computer to the same Wi-Fi network
-
Plug the device to the computer with a USB cable to configure the connection
-
On the computer command line type:
adb tcpip 5555
-
On the computer command line type:
adb shell ip addr show wlan0
and copy the IP address after the "inet" until the "/". You can also go inside the Settings of the device to retrieve the IP address in Settings → About → Status. -
On the computer command line type:
adb connect ip-address-of-device:5555
-
You can disconnect the USB cable from the device and check with adb devices that the device is still detected.
3. Imagine AVD cu root și GMS
-
din Tools/SDK Manager/SDK platforms se adauga 'Android 15.0 ("VanillaIceCream")' API 35 Revison 2
-
Unzip lineage-gms-root.zip at location where studio keeps its images, for example
/opt/Android/SDK/system-images/android-35/lineage/x86_64
-
Create virtual device
Android Studio -> Device Manager -> +(Add New Device, small phone) -> API 35/Services = Show All -> Under System image it shows “LineageOS” but it doesn’t have the download icon ; under API it says ‘35’
-
Give it a unique name, say
Lineageos-EIM1
-
Additional settings - choose low specs: 2 CPU, 512M of RAM
-
Start => Setup – use 3 button navigation
-
In Android, go to Settings/About Device/Build number – click it 5 times to become a developer
-
Settings/search for root to find the option for rooted debugging; enable root
-
From developement machine
adb root
adb shell
- After first boot and setup, user data and apps are stored in $HOME/.android/avd/EIM_lineageos_1.avd/
- create a second machine if needed
Rulare laboratoare
Laborator | telefon real | emulator AVD |
---|---|---|
1 Diceroller | Y | Y |
2 Activități | Y | Y |
2 GUI | Y | Y |
2 Intenții | Y | Y |
2 Servicii | Y | Y |
2 Sockets | Y | Y |
2 Bluetooth | Y | Y |
2 HTTP | Y | Y |
2 Descoperire Servicii | Y | N |
2 SIP & VoIP | Y | Y |
2 Localizare | Y | Y |