Android-Studio-Featured-Image

How to develop Android apps in Linux

It can be intimidating if you are just starting to develop an app for Android. Here, you’ll find everything you need to know about creating, publishing, and releasing an app on Android.

advice: If you just want an Android app without the hard work of coding it yourself, check out These are the platforms that allow you to create Android apps easily.

How do Android apps work

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

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

How to set up an Android development environment

A development environment is all the software tools you need to build applications. On Android, this is the Android software development kitor SDK.

Android development environment

Android Studio is the official IDE for Android app development. The simple interface and the fact that it pre-installs all the components of the SDK makes it a popular choice for upcoming developers.

To use snap to install it in Linux go to snap store and install “Android Studio”.

The installation package is also available at Android Studio website. There is an alternative PPA you can use, but you may not get the latest version and you will have to install each component individually.

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 that you need to develop on 64-bit machines. As many Android devices still use 4GB RAM or less. Download and unzip the android studio archive to the folder where you want to install the app.

Start the application with the following terminal commands:

cd "/bin"
./studio.sh

From there, you should be able to select the settings and components you want to install.

Android Studio 1 installation screenshot

The standard install will install all the components you need to develop Android apps using Java. Kotlin is integrated into Android Studio and requires no additional installation.

How to publish an Android app

Now that you have developed your own world-changing Android app, you need to get it on the App Store.

Version

Versioning is a simple process of naming and versioning your application. This lets users know what version of the app they are installing. As a developer, you can restrict app versions for specific Android distributions. By doing this, you can implement advanced features for the latest Android devices while still allowing weaker devices to access the app.

Add the following lines to the “build.gradle” file.

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

The versionCode It is an internal indicator of how many versions of your application have been released. versionName is how users will see the version name, and productFlavors Is installing a specific version on flavor. To restrict the versions your application can run on, use the following code:

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

We restricted our app to Android 12 or SDK version 31 with minSdkVersion . We also said that our “Sun” version can run on versions after SDK 21.

End User License Agreement (EULA)

The End User License Agreement – or EULA – tells users what they can do with the app. You don’t want someone to modify your code and publish their own application, but you probably want to allow users to add their own modifications to the application. The EULA allows you to dictate all of this. You can create your own EULA online or create one of your own.

encryption keys

In the same way that you have a key that unlocks your front door, your application needs a key to identify you as the owner. Encryption keys also let other apps and services know that your app is trustworthy. This prevents malware from infecting users’ computers or files Attacking web services Everyone uses it.

To create your key, go to “Generate” on the top bar. Select “Create a signed package”, then “Android App Bundle”. From there, create a new key. This will generate an upload key. However, to publish an app on the Google Play Store, you also need an App Signing Key. These are stored on users’ devices.

Turn on application signing

To generate an app signing key, sign in to the Play Console. Create your version and choose a way to release it. You can release your app for open testing, closed testing, internal testing, or production release.

Once you do that, enter the “Application Integration” section, which should generate a new key if this is your first time launching the app.

How to create an Android app bundle

If you are going to upload your app to the App Store, users should be able to download a package containing the compiled source code that their device can install. App bundles allow Google to easily create and distribute APKs for every version you choose.

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

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

Another way is to create a signed package using Android Studio, which you can do by going to the Build section on the top bar. Once you do that, you can drag and drop your application bundle into the “App Packages and APKs” section of the Play console. Remember, it must be less than 150MB in size.

poses

It’s finally time to roll out your app for everyone to use. Before doing this, make sure that the app’s pricing and page are correct on the App Content page. Go to the Versions Overview page and select Start Release.

Frequently Asked Questions

Do I need an Android device to start development?

No, hardware is good for testing and making sure your app looks the way you want it to. However, you don’t actually need one to develop Android apps. Simulations allow you to test on your computer. The whole suite of Android tools aims to make development on your PC possible.

Can applications be developed without using Google Play?

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

Subscribe to our newsletter!

Our latest lessons delivered straight to your inbox

#develop #Android #apps #Linux

Leave a Comment

Your email address will not be published. Required fields are marked *