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.
Related
It pushes to upgrade Gradle plugin, but once I did it, the whole bunch of errors pop up.
It looks like my project build.gradle:
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
}
module build.gradle:
dependencies {
...
testImplementation 'junit:junit:4.+'
testImplementation 'org.mockito:mockito-core:2.4.0'
testImplementation 'org.powermock:powermock-core:1.7.0RC2'
testImplementation 'org.powermock:powermock-module-junit4:1.7.0RC2'
testImplementation 'org.powermock:powermock-api-mockito2:1.7.0RC2'
}
and gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
do not work anymore.
I tried to change them, but could not bring my powermock back.
What is the right combination of versions?
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 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.
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 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