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:
aapt package -f -m -J ./src -M ./AndroidManifest.xml -S ./res -I /opt/android-sdk/platforms/android-28/android.jarjavac -d obj -classpath src -bootclasspath /opt/android-sdk/platforms/android-28/android.jar src/com/example/helloandroid/*.javadx --dex --output=./bin/classes.dex ./objaapt package -f -m -F ./bin/hello.unaligned.apk -M ./AndroidManifest.xml -S ./res -I /opt/android-sdk/platforms/android-28/android.jarcp ./bin/classes.dex .aapt add ./bin/hello.unaligned.apk classes.dexapksigner sign --ks mykey.keystore ./bin/hello.apkNow 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.
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