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:
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'
}
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.
Related
After I updated the Android studio to 4.0 version, the color picker dependency is not working: "implementation 'uz.shift:colorpicker:0.5#aar'". I also try another dependencies but same issue.
build.gradle
repositories {
maven { url "https://dl.bintray.com/dasar/maven" }
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
maven { url "https://jitpack.io" }
maven { url "http://dl.bintray.com/dasar/maven" }
mavenCentral()
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//rate alert
implementation 'com.github.hotchemi:android-rate:1.0.1'
implementation "androidx.exifinterface:exifinterface:1.0.0"
implementation "androidx.appcompat:appcompat:1.0.0"
implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.recyclerview:recyclerview:1.0.0"
implementation "com.google.android.material:material:1.0.0"
implementation "androidx.palette:palette:1.0.0"
implementation "androidx.browser:browser:1.0.0"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation 'uz.shift:colorpicker:0.5#aar'
implementation 'com.github.jetradarmobile:desertplaceholder:1.1.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.github.yalantis:ucrop:2.2.2'
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'
implementation 'jp.wasabeef:recyclerview-animators:2.2.7'
implementation 'com.github.HoraApps:Liz:-SNAPSHOT'
implementation 'com.github.lzyzsd:circleprogress:1.2.1'
// TODO check them out
implementation 'com.turingtechnologies.materialscrollbar:lib:10.0.3'
implementation 'de.psdev.licensesdialog:licensesdialog:1.8.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
}
Error
Failed to resolve: uz.shift:colorpicker:0.5
Show in Project Structure dialog
Affected Modules: app
Downgrade the version of gradle as of now, No proper solution is available.
It will work fine in ( Gradle Version - 5.6.4)
I've tried everything still it won't go away. As the problem struck when I downloaded the latest version. I simply switched back to the previous version of gradle and It's working fine now.
I wanted to port a kotlin project with gradle building from jvm to node.js. The build.gradle goes as follow:
plugins {
id 'org.jetbrains.kotlin.js' version '1.3.72'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
jcenter();
}
apply plugin: 'kotlin-kapt'
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-js"
testImplementation "org.jetbrains.kotlin:kotlin-test-js"
implementation 'org.apache.httpcomponents:httpclient:4.5.12'
implementation "com.squareup.moshi:moshi-kotlin:1.9.2"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5'
kapt 'com.squareup.moshi:moshi-kotlin-codegen:1.9.2'
testCompile 'junit:junit:4.12'
}
kotlin.target.nodejs { }
but received the gradle build error
Could not find method kapt() for arguments [com.squareup.moshi:moshi-kotlin-codegen:1.9.2]
and while this works fine with kotlin(jvm) project. I wonder why and how to solve this problem.
Thanks in advance.
Androidx and Jetifier both are enabled in gradle.properties.
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
All the dependicies i'm using
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.squareup.retrofit2:retrofit:2.7.0'
implementation 'com.github.mukeshsolanki:country-picker-android:2.0.2'
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
}
minSDK is set to 21. This is the error build throws, i want my to use retrofit with androidx and minSDK 21, can some body help with this.
Error: Invoke-customs are only supported starting with Android O
(--min-api 26)
I'm using kotlinx.serialization to obtain for example Data.serialize() according to this:
#Serializable
data class Data(val testField: String)
This works for a #Serializable class in the same project. I can use Data.serializer().
However, I also have a similar basic data class in an external jar from which I also want kotlinx.serialization to generate. But no corresponding .serializer() is generated for it. How should I configure Gradle for this?
project build.gradle
buildscript {
ext.kotlin_version = '1.3.60'
repositories {
mavenLocal()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
}
}
module build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlinx-serialization'
apply plugin: 'kotlin-kapt'
dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.14.0'
...
tried the following
kapt files('path/to/repository/com/external/jar-name.jar')
or
kapt files('path/to/repository/com/external/jar-name-sources.jar')
or
kapt 'com.external:jar-name:version'
or
kapt 'com.external:jar-name-sources:version'
}
Do I need to somehow add the source jar of the external library to AndroidStudio to be able to do this?
I have updated my Android studio to 3.2.1 since then am getting error as below
Unable to resolve dependency for ':app#debug/compileClasspath': Could
not resolve com.android.support:appcompat-v7:28.0.0.
hence unable to build my application
I have unchecked offline too
my dependencies in gradle file
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
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'
}
kindly suggest a solution for this
Regards.
Nagendra
I think you are using old version of build tool in project level build.gradle.
Try
classpath 'com.android.tools.build:gradle:3.2.1'
Update your Android Gradle plugin
1- Upade the classpath in top-level build.gradle to:
buildscript {
....
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
2- Update the Gradle version to 4.6 in the gradle-wrapper.properties file by changing the distributionUrl to:
...
distributionUrl = https\://services.gradle.org/distributions/gradle-4.6-all.zip
...
3- Go to ReBuild Project
classpath 'com.android.tools.build:gradle:3.2.1'
add this to the dependencies of buildscript. then Sync the project.
Thanks for the response,
Isuue was with proxy blocking the downloads,i have commented the proxy in gradle.properties then its started working, i was trying in the office network.
Regards.
Nagendra