How to develop Android apps on Linux

It can be intimidating when you’re just starting out with developing an app for Android. Here’s everything you need to know about creating, publishing, and sharing an app on Android.

Tip: If you just want an Android app without the hassle of coding it yourself, check out these platforms that will help you create Android apps easily.

How Android applications work

Android applications can be built in Java, Kotlin or C++. Most modern Android applications are built in Kotlin. Both Java and Kotlin can be combined into Java bytecode files. This process translates the human programming language into a binary computer language.

These files, along with images, layouts, and fonts, are compressed into a package called an APK file.

How to set up the Android development environment

A development environment includes all the software tools you need to build applications. For Android, this is the Android Software Development Kit or SDK.

Android Studio

Android Studio is the official IDE for developing Android applications. The simple user interface and the fact that all SDK components come pre-installed make it a popular choice for aspiring developers.

To use Snap to install on Linux, navigate to the Snap Store and install Android Studio.

The installation package is also available on the Android Studio website. There are alternative PPAs you can use, but you may not get the latest version and will need to install every single component.

Install the following dependencies:

sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386

These are 32-bit libraries you need for development on 64-bit machines. since many Android devices still use 4GB of RAM or less. Download the Android Studio archive and unzip it to the folder where you want to install the application.

Launch the application using the following terminal commands:

cd "<your application folder>/bin"
./studio.sh

From there you should be able to choose your settings and components you want to install.

Android Studio installation screenshot 1

The default installation installs all the components you need to develop Android applications with Java. Kotlin is built into Android Studio and requires no additional installation.

How to publish an Android application

After developing your Android app that will change the world, you need to download it from the App Store.

versioning

Versioning is the simple process of naming and numbering the version of your application. This lets users know which version of the application they are installing. As a developer, you can restrict application versions to specific Android distributions. This allows you to implement advanced features for the latest Android devices, but still allow weaker devices to access the app.

Add the following lines to your build.gradle file.

android {
   ...
    defaultConfig {
    ...
        versionCode = 7
        versionName = "7.0"
    }
    productFlavors {
        create("Sun") {
        ...
            versionName = "7.0-Sun"
        }
        create("Moon") {
        ...
        }
    }
}

That versionCode is an internal indicator of how many versions of your application have been released. versionName This is how users see the release name and productFlavors is to bind a specific version to a flavor. Use the following code to restrict the versions your application can run on:

android {
    ...
    defaultConfig {
        ...
        minSdkVersion(31)
        targetSdkVersion(31)
    }
    productFlavors {
        create("Sun") {
          ...
        }
        create("afterLollipop") {
          ...
          minSdkVersion(21)
        }
    }
}

We have limited our application to using Android 12 or SDK version 31 minSdkVersion . We also said that our “Sun” version can run on versions after SDK version 21.

End User License Agreement (EULA)

An End User License Agreement – or EULA – tells users what they can do with the application. You don’t want someone changing your code and releasing their own application, but you might want to allow users to add their own mods to the application. With a EULA, you can dictate all of this. You can generate your own EULA online or create your own.

Cryptographic Keys

Just like you have a key that opens your front door, your application needs a key to identify you as the owner. Cryptographic keys also allow other applications and services to know that your app is trusted. This prevents malware from infecting users’ devices or attacking web services that everyone uses.

To generate your key, navigate to “Build” on the top bar. Select “Generate Signed Bundle” and then “Android App Bundle”. Create a new key from there. This creates an upload key. However, in order to publish an application to the Google Play Store, you also need an “app signing key”. These are stored on the users’ devices.

Play app signature

To generate an app signing key, log in to your Play Console. Create your share and choose a sharing method. You can release your app for open testing, closed testing, internal testing, or a production release.

Once you’ve done that, go to the “App Integrity” section, which should generate a new key when you first publish the app.

How to create an Android app bundle

When you upload your app to the App Store, users must be able to download a package containing your compiled source code for their devices to install. App bundles allow Google to create APK packages for any version you choose and distribute them just as easily.

You can build it with these commands on the command line:

cd "<your application folder>/bin"
./gradlew bundleRelease
jarsigner -keystore <pathToKeystore> app-release.aab <keyAlias>

Another method is to generate a signed bundle using Android Studio, which you can do by navigating to the Build section on the top bar. Once you’ve done that, you can drag and drop your app bundle into the “App Bundles and APKs” section of the game console. Remember that it must be under 150MB.

unroll

It’s finally time to make your app available to all users. Before doing this, make sure your app’s pricing and page are correct on the App Content page. Navigate to the Releases Overview page and select Start Rollout.

frequently asked Questions

Do I need an Android device to start developing?

no A device is useful for testing and making sure your app looks the way you want it to. However, you don’t need one to develop applications for Android. Emulation allows you to test on your computer. The whole suite of Android tools aims to enable development on your PC.

Is it possible to develop apps without using Google Play?

Image credits: The Android robot in the featured image was reproduced or modified from work created and shared by Google and is used according to the terms described in the Creative Commons 3.0 Attribution License. All screenshots by Nathan Meyer

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Leave a Comment