Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

357
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda