Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

356
Views
Differences in developing Android kotlin apps vs Android Java apps on the command line (without android studio)

I am trying to compile a sample Android application (original source) written in kotlin on the command line.

The Java version of it compiles without a problem.

This is the file hierarchy layout:

.
├── AndroidManifest.xml
├── bin
├── mykey.keystore
├── obj
│   └── com
│       └── example
│           └── helloandroid
├── res
│   ├── drawable
│   ├── layout
│   │   └── activity_main.xml
│   └── values
│       └── strings.xml
└── src
    └── com
        └── example
            └── helloandroid
                ├── MainActivity.java
                └── MainActivity.kt

If I compile the Java version I issue the following commands:

  1. aapt package -f -m -J ./src -M ./AndroidManifest.xml -S ./res -I /opt/android-sdk/platforms/android-28/android.jar
  2. javac -d obj -classpath src -bootclasspath /opt/android-sdk/platforms/android-28/android.jar src/com/example/helloandroid/*.java
  3. dx --dex --output=./bin/classes.dex ./obj
  4. aapt package -f -m -F ./bin/hello.unaligned.apk -M ./AndroidManifest.xml -S ./res -I /opt/android-sdk/platforms/android-28/android.jar
  5. cp ./bin/classes.dex .
  6. aapt add ./bin/hello.unaligned.apk classes.dex
  7. apksigner sign --ks mykey.keystore ./bin/hello.apk
  8. Install the App via adb on a Google Pixel and it works.

Now the question is: How would I replicate that "workflow" with kotlin?

As far as I understand the only steps I need to change are the first two. I need to generate a R.kt file, because otherwise R is undefined and step two where I actually compile the sources to classes. After that there should be no difference ?

I don't want to use gradle. I just want to understand how I can use the command line utils.

Thanks in advance for any helpful answer :D

EDIT: The Source is completely in Kotlin, not a mix of Java+Kotlin as shkschneider suggested. The MainActivity.java is essentially the same Code as MainActivity.kt I just want to switch to Kotlin.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I solved the Problem. The R.kt file has to be generated via the JetBrains IDE from the R.java file, because they don't provide a standalone tool. If someone knows one please share a link :D

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!