Closed achille-martin closed 1 year ago
Resources on how to setup adb
for physical device testing: Julien's website.
Resources on how to setup Android Emulator in Android Studio on Ubnuntu: Expo dev website.
Add these to your ~/.bashrc
:
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools
If you want to run an Emulator inside VirtualBox, you need to enable nested virtualisation: Oracle tips.
If the nested virtualisation option is greyed-out in Windows: Stackoverflow website.
Find your Virtual Box install folder thanks to Openwaterfoundation and find the name of your VM from the Virtual Box window app (Settings -> General -> Name). Use quotes "
if your name contains spaces.
If you still have issues starting the emulator up in VirtualBox, make sure that:
bcdedit
command to turn the feature on/off Nakivo blog -> from the CMD bcdedit /set hypervisorlaunchtype off
and to re-enable it BCDEDIT /Set {current} hypervisorlaunchtype auto
. Note that having Hyper-V off degrades performance of VirtualBox itself so you want to keep it on when not testing.If you have issues with /dev/kvm device permission denied
: try the approach suggested on Stackoverflow:
sudo apt install qemu-kvm
ls -al /dev/kvm
sudo adduser <Replace with username> kvm
sudo chown <Replace with username> /dev/kvm
If it is still too slow [VirtualBox tip didn't work for me], then setup Android Studio and Emulator on a proper Ubuntu desktop: follow the instructions from External dependencies setup.
Note: install the latest version available, no need to restrict ourselves to Android 28
.
Note2: start the device from the device manager window create device
.
Note3: use recommended heap memory if suggested to run the app faster.
:+1: WORKED
Once the Device emulator is working, drag and drop your .apk
onto the virtual device. You can find the installed app in your list of available apps on the device.
:+1: WORKED
To debug your .apk
in Android Studio with adb
, make sure that:
adb
is connected to the virtual device: adb devices
adb logcat *:<debug_level>
where for instance W
for WARNING
You can open the virtual device file manager by: View -> Tool Windows -> Device file explorer
For instance, the ~
folder for your app is under: /data/data/org.qtproject.example.ExamplePyQt5DatabaseAndroidApp/files
You can view the content of your database (in the virtual device) by right cliking on the .db
file (in the device file manager) and Saving the file to your laptop; then open the .db
with sqlitebrowser
(sudo apt-get install sqlitebrowser
).
My current way of debugging the .apk is to:
The issue is that although the .apk is generated without bugs, it does not mean that it will work on an Android phone right away (ex: using wrong file system). Furthermore, I don't have access to crash logs.
Therefore, there is a need to find a tool to perform .apk debugging.
adb
tool has been recommended.