I have installed android with the latest stuff:
brew install ant
brew install maven
brew install gradle
brew install android-sdk
brew install android-ndk
brew install kotlin
I have a simple hello world example.kt
file like this:
package foo.bar
fun ms() : Long {
return System.currentTimeMillis()
}
And a test.kt
like this:
package foo.bar
fun main(args: Array<String>) {
println(ms())
}
which is compiled and run like this:
kotlinc src -include-runtime -d test.jar
kotlin test.jar
Next I would like to display a triangle using OpenGL on Android. A basic hello world example. I've checked through quite a few resources but haven't seen how to actually compile an Activity using kotlinc
, which seems like the main "application object" in Android.
- https://github.com/egslava/example-Kotlin-Android-GLSurfaceView
- https://github.com/jvm-graphics-labs/hello-triangle
- https://github.com/jvm-graphics-labs/hello-triangle/blob/master/src/main/kotlin/gl4/helloTriangle.kt
- https://github.com/JetBrains/kotlin-native/blob/master/samples/opengl/src/openglMain/kotlin/OpenGlTeapot.kt
- https://github.com/egslava/example-Kotlin-Android-GLSurfaceView/blob/master/app/src/main/java/ru/egslava/tutorialglsurfaceview/MainActivity.kt
- https://github.com/bnlrnz/MandelGL
- https://github.com/bnlrnz/MandelGL/blob/master/app/src/main/java/de/tubaf/mandelGL/MandelGLRenderer.kt
- https://www.codementor.io/joshuaaroke/android-kotlin-vs-java-by-example-part-1-simple-hello-world-a899inz3o
- https://medium.com/@passsy/starting-activities-with-kotlin-my-journey-8b7307f1e460
- https://medium.com/@FizzyInTheHall/building-an-android-activity-from-scratch-with-kotlin-a5c0f5b6520a
- Kotlin Android start new activity
- https://developer.android.com/training/graphics/opengl/environment.html
- https://github.com/JimSeker/opengl/blob/master/HelloOpenGLES20/app/src/main/java/com/example/android/opengl/Triangle.java
- https://developer.android.com/reference/kotlin/android/opengl/GLES20
- https://github.com/ligee/kotlin-ndk-samples/blob/master/native-codec/src/com/example/nativecodec/MyGLSurfaceView.kt
- Why shouldn't an Android app be written in C/C++ because you "simply prefer to program in C/C++"?
- https://github.com/JimSeker/opengl/blob/master/HelloOpenGLES32/app/src/main/java/edu/cs4730/helloopengles32/Triangle.java
- https://tutorialwing.com/android-textureview-using-kotlin-with-example/
- https://github.com/googlemaps/android-samples/blob/master/ApiDemos/kotlin/app/src/main/java/com/example/kotlindemos/MainActivity.kt
- https://developer.android.com/studio/build/building-cmdline
For reference, these imports seem relevant to android sdk OpenGL:
import android.opengl.GLES20
import android.opengl.GLES32
import android.graphics.SurfaceTexture
import android.opengl.GLSurfaceView
Anyways, basically what this boils down to is how to render an Activity using kotlinc, purely from the command line, without Android Studio or any UI/IDE. Once I get there then I can figure out how to do OpenGL.
So for example, this post shows this Activity boilerplate:
package me.mladenrakonjac.modernandroidapp
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}
I would like to just render a HelloWorld Activity (without any AndroidManifest.xml if possible, just Kotlin instead of XML, unless XML is required, I'm new to Android), from the command line. Not sure how to take that MainActivity
snippet and compile it and render it, maybe add a textarea with "hello world" in it.
If not possible with Kotlin, then wondering how to do it with Gradle/Java.