Development of mobile applications for Android remains one of the most popular IT specialties: according to data Stack Overflow, more than 40% of professional developers work with this in one way or another platform. But where to start if you've never written code for smartphones? This article will help you understand the basics - from choosing a programming language to publishing a finished application in Google Play.

We will not delve into the theory of algorithms or low-level programming. Instead, let's focus on practical steps: how to install the necessary tools, write your first application in Kotlin or Java, test it on an emulator and avoid typical beginner mistakes. And if you already have experience in developing for other platforms, you will find here a comparison of approaches and tips on adapting existing skills.

It is important to understand: since 2023, Google officially recommends using Kotlin as the main language for Android development, but Java support remains for legacy projects. This doesn't mean that Java is outdated - it's just that Kotlin offers more modern syntax and better integration with the Android SDK. In this article we will look at both options so that you can choose the one that suits you.

1. Choosing a programming language: Kotlin vs Java

The first question that beginners ask: what language to write for Android? The official documentation clearly recommends it, but is still widely used. Let's compare both options: Google definitely recommends Kotlin, But Java is still widely used. Let's compare both options:

  • ๐Ÿ“Œ Kotlin - a modern language with a concise syntax, full compatibility with Java and built-in support for coroutines for asynchronous operations. Ideal for new projects.
  • ๐Ÿ’ผ Java - a time-tested language with a huge number of libraries and frameworks. Suitable for supporting older applications or if you plan to develop in enterprise development.
  • โšก C++/Rust โ€” used for high-performance components (for example, games or graphics processing), but require deep knowledge.

For absolute beginners, we recommend starting with Kotlin โ€”its syntax is more intuitive, and development tools (for example, Android Studio) are optimized for this language. If you already know Java, you can continue to use it, but gradually master it and Kotlin for new features.

โš ๏ธ Attention: When choosing a language, consider the requirements of the employer or customer. Some companies still use Java for Android projects, especially when it comes to banking applications or systems with high security requirements.
Criteria Kotlin Java
Ease of learning โญโญโญโญโญ โญโญโญ
Compatibility with Android SDK Full (official support) Full (but some features require wrappers)
Performance Comparable to Java Slight advantage in some cases
Support for coroutines/threads Built-in (coroutines) Requires RxJava or other libraries
๐Ÿ“Š What language do you plan to use for Android development?
Kotlin
Java
Both options
Another language

2. Installation and configuration of Android Studio

Android Studio is the official development environment (IDE) from Google, which includes everything you need to create Android applications: a code editor, a device emulator, debugging and analytics tools. You can download it for free from the official website. Minimum PC requirements:

  • ๐Ÿ–ฅ๏ธ OS: Windows 8/10/11 (64-bit), macOS 10.14 or later, or any modern Linux distribution.
  • ๐Ÿ’พ RAM: Minimum 8 GB (16 GB recommended for working with the emulator).
  • ๐Ÿ“ฆ Disk space: At least 4 GB for the IDE itself + 1-2 GB for SDK and emulators.

After installing Android Studio, follow these steps:

Install the latest version of Android Studio from the official site|

Download and install the necessary SDK components (the IDE itself will offer you upon first launch)|

Create a new project with the "Empty Activity" template|

Set up a device emulator (Pixel 5 with Android 13 is recommended)|

Connect a physical device debugging device (optional)-->

If you are using Windows, make sure that virtualization is enabled in the BIOS (for the emulator to work). On macOS may need to be installed Homebrew to manage dependencies. For Linux check the availability of packages libc6:i386, libncurses5 and others that the system will require.

โš ๏ธ Attention: When installing the SDK, avoid paths with spaces or Cyrillic characters (for example, C:\app Files\...). This may lead to build errors. Use shortcuts like C:\Android\SDK.

After setup, check the system's functionality by running an empty project on the emulator. If everything works, you will see the standard application with the inscription "Hello World". If errors occur, refer to the logs in the window Build Output โ€”it usually indicates which component is missing or incorrectly configured.

3. Android project structure: what lies where

When you create a new project in Android Studio, the IDE generates a standard file structure. Understanding it is critical so as not to get lost in the code. Here are the main directories and files:

  • ๐Ÿ“ app/src/main/java/ โ€” here is the source code of your application (activities, fragments, classes).
  • ๐Ÿ“„ app/src/main/AndroidManifest.xml โ€” application manifest, where all components (activities, services) and permissions are declared.
  • ๐ŸŽจ app/src/main/res/ โ€” resources: layouts (layout/), images (drawable/), lines (values/strings.xml).
  • ๐Ÿ› ๏ธ app/build.gradle โ€” build configuration, dependencies and SDK version.
  • ๐Ÿ“ฆ gradle/ โ€” build system files Gradle.

Pay special attention to the file AndroidManifest.xml. Specify here:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

package="com.example.myapp">

<application

android:allowBackup="true"

android:icon="@mipmap/ic_launcher"

android:label="@string/app_name">

<activity android:name=".MainActivity">

<intent-filter>

<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />

</intent-filter>

</activity>

</application>

</manifest>

In this file you declare:

  • ๐Ÿ“Œ Application package name (package).
  • ๐Ÿ”ง Permissions (for example, access to the Internet or camera).
  • ๐Ÿ“ฑ Application components (activities, services, receivers).
๐Ÿ’ก

Always check AndroidManifest.xml before building the APK. Errors in this file (for example, typos in activity names) cause the application to crash on startup, but are not always obvious at the compilation stage.

4. Creating the first application: "Hello World" in Kotlin

Let's write a simple application that displays text and responds to button clicks. We will use Kotlin and standard components Android SDK.

Step 1: Interface design

Open the file res/layout/activity_main.xml and switch to mode Code (not Design). Replace the content with:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical"

android:gravity="center">

<TextView

android:id="@+id/helloText"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Hello, Android!" />

<Button

android:id="@+id/clickButton"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Click me" />

</LinearLayout>

Step 2: Logic in MainActivity

Now open MainActivity.kt (located in java/com.example.myapp/) and add a handler press:

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {

super.onCreate(savedInstanceState)

setContentView(R.layout.activity_main)

val button = findViewById<Button>(R.id.clickButton)

val textView = findViewById<TextView>(R.id.helloText)

button.setOnClickListener {

textView.text = "The button is pressed! ๐ŸŽ‰"

}

}

}

Step 3: Launch on the emulator

Press the green button Run (or Shift + F10) and select the previously configured emulator. In a few seconds you will see your application with a button. When clicked, the text will change.

๐Ÿ’ก

Always test the application on several versions of Android (for example, 11, 12, 13). Some APIs may behave differently or be missing on older devices.

5. Debugging and testing: how to find and fix errors

Errors in Android development are divided into three types:

  1. Compilation errors - syntax errors in the code that prevent the project from being built. Fixed in the IDE.
  2. Runtime errors โ€”exceptions that occur while the application is running (for example, NullPointerException).
  3. Logical errors โ€”the application runs, but does not behave as intended.

Basic debugging tools in Android Studio:

  • ๐Ÿž Logcat โ€” system message log All logs are displayed here, including errors (ERROR) and warnings (WARNING).
  • ๐Ÿ” Debugger โ€” allows you to step through the code and monitor the values. variables.
  • ๐Ÿ“Š Android Profiler โ€” analyzes the use of CPU, memory and energy.

Example of use Logcat:

// In code (for example, in MainActivity.kt)

Log.d("MyApp", "This is a debug message")

Log.e("MyApp", "This is an error message", exception)

// In Logcat, filter logs by tag "MyApp"

For UI testing, we recommend using Espresso (for unit tests) and UI Automator (for complex testing). Example of a simple test with Espresso:

@RunWith(AndroidJUnit4::class)

class MainActivityTest {

@get:Rule

val activityRule = ActivityTestRule(MainActivity::class.java)

@Test

fun testButtonClick() {

onView(withId(R.id.clickButton)).perform(click())

onView(withId(R.id.helloText)).check(matches(withText("The button is pressed! ๐ŸŽ‰")))

}

}

โš ๏ธ Attention: When testing on a physical device, turn on USB debugging in the developer settings. On some devices (for example Xiaomi or Huawei), you additionally need to enable debugging in MIUI/EMUI.
How to enable developer mode on Android

1. Go to Settings โ†’ About phone.

2. Find the item Build number and click on it 7 times.

3. Return to the main settings menu - a new section will appear For Developers.

4. Enable USB debugging and Do not turn off the screen (optional).

6. Publishing to Google Play: Requirements and Process

Once your app is ready, you can publish it to Google Play Console. To do this you will need:

  • ๐Ÿ’ฐ Registration fee: $25 (one-time).
  • ๐Ÿ“ Developer account: register on play.google.com/console.
  • ๐Ÿ“ฆ Signed APK/AAB: the application must be signed by the release key.
  • ๐Ÿ“„ Manifesto and policies: the application must comply with the rules Google Play (for example, do not collect user data without consent).

Publishing process:

  1. Collect the release version of the application (Build โ†’ Generate Signed Bundle / APK).
  2. Download .aab (Android App Bundle) to Google Play Console.
  3. Fill in information about the application: name, description, screenshots (minimum size - 320px), icon (512x512 px).
  4. Indicate the category, age rating and price (free or paid).
  5. Submit for review. Typically, verification takes 1-3 days.

Typical reasons for application rejection:

  • ๐Ÿšซ Violation of the privacy policy (for example, collecting data without Privacy Policy).
  • ๐Ÿ”ž Inconsistency with the age rating (for example, adult content without labeling).
  • ๐Ÿ“ฑ Poor optimization (app crashes on most devices).
โš ๏ธ Attention: Since 2021, Google requires that all new applications be published in Android App Bundle (.aab)rather than APK format. This allows you to optimize the download file size for different devices.
File type APK AAB
Format Universal package Modular package
Size Fixed (can be large) Optimized for the device
Support for dynamic features โŒ No โœ… Yes
Google Play required? โŒ No (can be installed manually) โœ… Yes (only for Play Market)

7. Optimization and monetization: how to make money from the application

Even a simple application can be monetized. Basic ways:

  • ๐Ÿ’ณ Paid application โ€”users pay for downloading. Suitable for niche applications with a unique feature. functionality.
  • ๐ŸŽฏ Advertising - integration AdMob, Facebook Audience Network or other networks. Income depends on the number of impressions.
  • ๐Ÿ›’ In-app purchases - sale of premium features, virtual goods or subscriptions.
  • ๐Ÿค Affiliate apps โ€”for example, links to products with Amazon or AliExpress.

To integrate advertising through AdMob:

  1. Register on admob.google.com and create a banner or interstitial ad.
  2. Add a dependency to build.gradle:
    implementation 'com.google.android.gms:play-services-ads:22.6.0'
  3. Place the ad unit in the layout:
    <com.google.android.gms.ads.AdView
    

    android:id="@+id/adView"

    android:layout_width="wrap_content"

    android:layout_height="wrap_content"

    ads:adSize="BANNER"

    ads:adUnitId="ca-app-pub-3940256099942544/6300978111"/>

  4. Download the updated application in Google Play.

To optimize performance:

  • ๐Ÿ”„ Use RecyclerView instead ListView for long lists.
  • ๐Ÿ–ผ๏ธ Compress images using WebP instead of PNG/JPEG.
  • ๐Ÿ—‘๏ธ Remove unnecessary dependencies in build.gradle โ€”they increase the size of the APK.
  • ๐Ÿ”‹ Optimize your network experience: use caching and execute queries in a background thread.
๐Ÿ’ก

Before publishing, test the application on devices with different screen resolutions and Android versions. Use Firebase Test Lab for automatic testing on virtual devices.

FAQ: Frequently asked questions about Android development

Is it possible to develop for Android on Mac or Linux?

Yes, Android Studio officially supports macOS and Linux (including Ubuntu, Fedora and other distributions). The only difference is that on Linux you may need to manually install some dependencies (for example lib32z1 or libncurses5). On Mac, make sure you have the latest version installed Xcode (to work with the emulator).

How long does it take to learn Android development from scratch?

Time depends on your programming experience:

  • ๐Ÿข Beginner without experience: 3-6 months to master basics Kotlin/Java, Android SDK and creation of first applications.
  • ๐Ÿƒ Experienced programmer (knows OOP, works with other languages): 1-2 months to adapt to Android specifics.

We recommend taking the official course Android Basics in Kotlin from Google - it is free and covers all key topics.

How to test an application on a real device without Google Play?

You can install the APK on a physical device device without publishing to Google Play:

  1. Collect APK in Android Studio (Build โ†’ Build Bundle(s) / APK(s) โ†’ Build APK).
  2. Transfer the file .apk to the device (for example, via USB or cloud storage).
  3. On the device allow installation from unknown sources (Settings โ†’ Security โ†’ Unknown sources).
  4. Run the APK file - the application will be installed.

For convenience, use the command adb install app-debug.apk from the terminal (requires a USB connection and enabled debugging).

What should I do if Google Play rejected my application?

First, carefully read the letter with the reason for rejection. Most often, problems are related to:

  • ๐Ÿ“œ Violation privacy policy: add a link to Privacy Policy in the application description.
  • ๐ŸŽฎ Content inconsistency: if your application is for children, but contains advertising without marking, it will be blocked.
  • ๐Ÿž Crashes on devices: test on emulators with different versions of Android.

Fix the problems and resubmit the application for review. If you do not agree with the decision, you can appeal through the form in Google Play Console.

Do I need to know Java if I want to learn Kotlin?

No, Kotlin is an independent language, and it can be learned without knowledge Java. However, understanding Java will help:

  • ๐Ÿ“š Read old documentation or code of legacy projects.
  • ๐Ÿ”ง Work with libraries written in Java.
  • ๐Ÿ’ผ Pass interviews - some companies still ask for Java in interviews.

If your goal is only Android development, you can limit yourself to Kotlin and study Java as needed.