Android app development without Android Studio
This note is written for those who cannot or do not want to use Android Studio.
1. Install dependecies
- jdk21-openjdk
- gradle 8.10.1-1
- android-build-tools r34.0.0-2
- android-cmdline-tools 13.0-3
- android-platform-tools 35.0.1-1
- android-platforms 35_r01-1
Arch Linux example
sudo pacman -S jdk21-opendjk gradle
mkdir -p ~/.aur
cd ~/.aur
for i in sdk-build-tools sdk-platform-tools sdk-cmdline-tools-latest platform;
do
git clone https://aur.archlinux.org/android-$i.git
cd android-$i
makepkg -sric
done
2. Initialize project
mkdir alpha
cd alpha
gradle init
Select type of build to generate:
1: Application
2: Library
3: Gradle plugin
4: Basic (build structure only)
Enter selection (default: Application) [1..4]
Select implementation language:
1: Java
2: Kotlin
3: Groovy
4: Scala
5: C++
6: Swift
Enter selection (default: Java) [1..6] 2
Enter target Java version (min: 7, default: 21):
Project name (default: alpha):
Select application structure:
1: Single application project
2: Application and library project
Enter selection (default: Single application project) [1..2]
Select build script DSL:
1: Kotlin
2: Groovy
Enter selection (default: Kotlin) [1..2]
Select test framework:
1: kotlin.test
2: JUnit Jupiter
Enter selection (default: kotlin.test) [1..2]
3. Configure build
settings.gradle.kts
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "alpha"
include(":app")
build.gradle.kts
plugins {
id("com.android.application") version "8.6.0" apply false
id("com.android.library") version "8.6.0" apply false
id("org.jetbrains.kotlin.android") version "2.0.20" apply false
}
app/build.gradle.kts
plugins {
id("croid.application")
id("org.jetbrains.kotlin.android")
}
kotlin {
jvmToolchain(21)
}
android {
namespace = "com.d4yr41n.alphda"
compileSdk = 35
defaultConfig {
applicationId = "com.d4yr41n.alpha"
minSdk = 21
targetSdk = 35
versionCode = 1
versionName = "1.0"
}
}
4. Write source code
app/src/main/kotlin/MainActivity.kt
package com.d4yr41n.alpha;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
class MainActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState);
val label = TextView(this);
label.text = "It's alive!";
setContentView(label);
}
}
app/src/main/AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.d4yr41n.alpha">
<application android:label="Alpha">
<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>
5. Connect your device via adb and install the app.
adb connect 192.168.0.100:12345
./gradlew installDebug