How To Develop Android Apps or Modules Without IDE (Android Studio | IntelliJ)
Virtually all Android projects are created with Android Studio or IntelliJ IDEA. That isn't great for learning because you will not understand how things work such as components that make up an Android projects, how build are setup and configured, etc.
Why would anyone wants to develop Android apps or modules without Android Studio? There are several possible reasons.
- Android Studio consumes lots of memory and works slowly on many computers or Macs,
- The Android Studio no longer supports the AGP of the project and you cannot upgrade the AGP anymore since it'll breaks the project dependencies.
Disclaimer: This guide is provided "as is" with no warranties with regard to the accuracy and completeness of the information provided herein. I expect you to have an inquisitive mind to try things out, and the patience to first google and try to find answers to simple questions.
Understanding The Android Projects Structure
Install The Java SDK
- Go to terminal and enter java -version
- In the terminal type and enter javac -version
Install The Java & Android SDK from Command Line
- See install the Java SDK above.
- Go to the normal install page and scroll right to the bottom at Command Line Tools.
- Follow the instructions here to install the packages https://developer.android.com/studio/command-line/sdkmanager
Install Gradle
Let's Create The Android Project From Command Line
iMac GradleProjects % mkdir MultiYummyAPIiMac GradleProjects % cd MultiYummyAPIiMac MultiYummyAPI % lsiMac MultiYummyAPI % gradle initStarting a Gradle Daemon (subsequent builds will be faster)Select type of project to generate:1: basic2: application3: library4: Gradle pluginEnter selection (default: basic) [1..4] 3Select implementation language:1: C++2: Groovy3: Java4: Kotlin5: Scala6: SwiftEnter selection (default: Java) [1..6] 4Select build script DSL:1: Groovy2: KotlinEnter selection (default: Kotlin) [1..2] 2Project name (default: MultiYummyAPI):Source package (default: MultiYummyAPI): me.about.ronillo.yummyapi> Task :initGet more help with your project: https://docs.gradle.org/7.1.1/samples/sample_building_kotlin_libraries.htmlBUILD SUCCESSFUL in 10m 48s2 actionable tasks: 2 executed
Here's the files and folders I got after initializing the project:
- gradle/wrapper
- gradlew
- gradlew.bat
- lib
- settings.gradle.kts
Let's Create The Android Build
buildscript {
repositories {
// Gradle 4.1 and higher include support for Google's Maven repo using
// the google() method. And you need to include this repo to download
// Android Gradle plugin 3.0.0 or higher.
google()
...
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.0")
}
}
Comments
Post a Comment