Can't run Android helloworld properly in arch linux

Hello,
I’m on a Thinkpad x200 and i run arch linux on it with dwm as window manager (doesn’t really matter, precision purposes only).

I’m trying to follow the Hello World tutorial at the following link:
https://docs.juce.com/master/tutorial_android_studio.html

I’ve tried it on a Windows machine and it works properly, even if it seems a little outdated (names of options to be selected in SDK manager are different, the fact that there’s no need to specify NDK path in Juce’s global path settings anymore and so on).

The first problem i noticed is that when i create a New Project from Projucer (after having selected Android as exporter), i can’t just “click on Save Project and Open in IDE” as it says, because nothing happens when i do it from the File menu, and the Android symbol on which i should be clicking on is greyed out.

I can’t find in the settings where i should specify where android studio actually is located in my system in order for it to work.

So afterwards i go on the Android Studio directory, inside the bin directory, and i run, from terminal, “./studio.sh /path/to/NewProject &”. I also tried opening android studio without specifying the path to my project, because it seems to open it anyway.

So i’m in Android Studio with the NewProject folder opened. I substitute the MainWindow section as it says in the tutorial so it can print “Hello World” and the i see that there’s no default configuration run setting for my app. I’ve tried to tweak some options, creating one on my own, but i can’t run it on a (virtual or physical, tried both) device.

When i load android studio a notification appears saying that there is a Gradle Build option for the project, but if i create a configuration based on it, it still does not show me the app.

Comparing it on how it works on Windows, on which the Android Symbol isn’t greyed out and opens Android Studio correctly from Projucer, there should be an “App” run configuration that works out of the box with the simple need of just creating a virtual device, which i did indeed also on my linux machine.

What can i do in order to make it work properly?

Ok so, apparently i made some newbie mistakes here, i’ll explain what made it work for me so it can help the other linux folks out there:

I downloaded juce from the website, so i have Juce in my ~/JUCE directory, because i moved it here from the Downloads folder. If you visit the Juce arch wiki page, it tells you it needs 16 packages (Dependencies) in order to work. I installed them all with pacman.

https://archlinux.org/packages/extra/x86_64/juce-docs/

Next thing i did was opening up Projucer and go to the File Menu, down to Global paths and here you can paste the path to your android studio binary. I downloaded android-studio and followed all the instruction given in the link i posted in the question above. Generally, the android-studio bin is located inside the android-studio folder you download, inside bin, and it is “studio.sh”. So, in my case, i copied “~/Dev/android-studio/bin/studio.sh” inside the option in Projucer and this made the Android logo inside Projucer get colored and the “Save and open in IDE” option from File menu work.

Clicking on Android logo from Projucer after having created a NewProject, made android-studio open with the default “out of the box” configuration run i was missing before, comparing it to how it worked on the Windows machine. After waiting a while for Android Studio to install automatically everything it needed, when trying to build i was missing a jpeg related .h file. So i installed the library needed, libjpeg9 (with pacman) if i’m not wrong, and again, after trying to build and run, it was giving me a debug.keystore error (which seems to be quite frequent). I installed the keytool utility ( keytool-openjdk20 package installed with pacman), and called it with the following flags:

keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000

and then i copied it where android-studio was saying, reading from the error message, that it needed it. Finally I was able to run the Hello World app as in the tutorial. I’m actually running it on my Android (GrapheneOS) phone via Wifi, so i don’t know if these settings also work on Virtual Devices.

This is what made it work for me and i could be wrong on something i did. Peace.

I’m glad you were able to solve your problems, thanks for sharing the solution!

What do you mean by this, specifically the “via Wifi” part?

Hi, what i mean is that Android studio tells you that there are 2 ways to test the app you are writing. The first one is to create a Virtual Device and test the app on it. The second one is testing it on a Physical Device, so you can pair your Android Device with your computer and test the app directly on it. In order to do that you have tu unlock Developer options on your android phone and enable from there wifi debugging.

In my case, since the Thinkpad x200 has got a poor graphic card, it was the only way i had to test my app. Virtual Devices were not functioning at all. Also, by doing that, you are not overloading your RAM as android-studio, in order to run, is already taking almost all of it. (2,6 / 3,4 GB).

Complete intructions at Run apps on a hardware device  |  Android Studio  |  Android Developers

1 Like