Search code examples
android-studioandroid-gradle-pluginbuild.gradlekorge

Android Studio - KorGE plugin - build.gradle


I would like to use Open Source KorGE Game Engine. I'm using Android Studio and I would like to know if anyone know how to import the library. I've installed the plugin following the setup documentation. Could anyone show me how to setup right my build.gradle? Thanks in Advance

UPDATE: Following @soywiz suggestion this problem occurred: compiling error

UPDATE Thanks to soywiz , now I can use KorGe In my Android Project. Just set in build gradle:

buildscript {
repositories {
    google()
    jcenter()
    maven {
        url = uri("https://plugins.gradle.org/m2/")
    }
    maven { url = uri("https://dl.bintray.com/kotlin/kotlin-dev") }
}
dependencies {
        ...
  }
}

   allprojects {
    repositories {
        mavenLocal()
        maven { url = 'https://dl.bintray.com/korlibs/korlibs' }
        google()
        jcenter()
        maven { url = uri("https://dl.bintray.com/kotlin/kotlin-dev") }
        }
    }

and in build.gradle (app):

dependencies {

    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.soywiz.korlibs.korge:korge-android:1.13.3'
    implementation 'com.soywiz.korlibs.klock:klock-android:1.11.12'
    implementation 'com.soywiz.korlibs.kmem:kmem-android:1.10.5'
    implementation 'com.soywiz.korlibs.kds:kds-android:1.10.12'
    implementation 'com.soywiz.korlibs.korma:korma-android:1.11.16'
    implementation 'com.soywiz.korlibs.korio:korio-android:1.11.7'
    implementation 'com.soywiz.korlibs.korim:korim-android:1.12.24'
    implementation 'com.soywiz.korlibs.korau:korau-android:1.11.9'
    implementation 'com.soywiz.korlibs.korgw:korgw-android:1.12.18'
    implementation 'com.soywiz.korlibs.krypto:krypto-android:1.11.1'
    implementation 'com.soywiz.korlibs.korinject:korinject-android:1.10.1'
    implementation 'com.soywiz.korlibs.klogger:klogger-android:1.10.1'
}

Solution

  • The easiest way / most up-to-date way to find out the build.gradle requirements is to actually build a project using KorGE.

    If you download this repo: https://github.com/korlibs/korge-hello-world

    Then execute:

    ./gradlew installAndroidDebug
    

    This will create a folder called build/platforms/android containing a build.gradle file with all the details.

    The important parts:

    repositories {
        // ...
        maven { url = 'https://dl.bintray.com/korlibs/korlibs' }
        // ...
    }
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72'
        implementation 'com.android.support:multidex:1.0.3'
        implementation 'com.soywiz.korlibs.korge:korge-android:1.13.3'
        implementation 'com.soywiz.korlibs.klock:klock-android:1.11.12'
        implementation 'com.soywiz.korlibs.kmem:kmem-android:1.10.5'
        implementation 'com.soywiz.korlibs.kds:kds-android:1.10.12'
        implementation 'com.soywiz.korlibs.korma:korma-android:1.11.16'
        implementation 'com.soywiz.korlibs.korio:korio-android:1.11.7'
        implementation 'com.soywiz.korlibs.korim:korim-android:1.12.24'
        implementation 'com.soywiz.korlibs.korau:korau-android:1.11.9'
        implementation 'com.soywiz.korlibs.korgw:korgw-android:1.12.18'
        implementation 'com.soywiz.korlibs.krypto:krypto-android:1.11.1'
        implementation 'com.soywiz.korlibs.korinject:korinject-android:1.10.1'
        implementation 'com.soywiz.korlibs.klogger:klogger-android:1.10.1'
        implementation 'com.android.support:appcompat-v7:28.0.0'
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    }
    

    All the dependencies might change in the future, so my advice is to trigger the hello world android build, so you get an up-to-date build.gradle file.