Open RedJocker opened 2 years ago
Hi, I deleted unnecessary gradle settings
ok it looks better.
now it would be good to see if we can lower the version of your extra dependencies to see if we can lower the compileSdkVersion to ideally match the one that comes on hs.android which is currently 29 as you can see here
, but it may be a good idea to do the whole thing and try to lower the dependency later to be sure it will work with the whole project.
So for now keep as it is, but I'll keep the issue open for a later moment
Ok, I will do that later at the end of project.
hey, this commit 36c5bb1bb257e381b70efceec29b22a5eae57bcf made some changes to the project level build.gradle and we should not change that. That file and settings.gradle are big headaches because we have to make it compatible to every system. This track had a lot of problems with gradle files before, but this current version is working and finally complaints about build failures are old comments only. So please don't touch those, you shouldn't really need to change those since they are more related to project building
Hi, I did some updates for a newer version of Kotlin, and then my Gradle just stopped working, so I need to change some Gradle settings to make it work
that is odd, the kotlin version should be the one in the module build.gradle. You shouldn't have to worry about which is the kotlin version.
Try using the original config and if it breaks send me the error
This error shows with original config file :
A problem occurred evaluating root project 'android-bank-manager-main'.
> Could not find method androidGradleVersion() for arguments [7.2.0] on object of type org.gradle.api.internal.initialization.DefaultScriptHandler.
Config file code : build.gradle
buildscript {
apply plugin: 'hyperskill'
wrapper {
gradleVersion = hs.android.gradleVersion
}
def kotlinGradleVersion = hs.android.kotlinGradleVersion
androidGradleVersion '7.2.0'
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.github.hyperskill:hs-gradle-plugin:release-SNAPSHOT'
classpath "com.android.tools.build:gradle:$androidGradleVersion"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinGradleVersion"
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
}
allprojects {
apply plugin: 'hyperskill'
repositories {
google()
mavenCentral()
}
afterEvaluate {
if (extensions.findByName('android') != null) {
android {
testOptions {
unitTests {
includeAndroidResources = true
all {
afterTest { TestDescriptor test, TestResult result ->
if (result.resultType == TestResult.ResultType.FAILURE) {
def message = result.exception?.message ?: "Wrong answer"
def lines = message.readLines()
println "#educational_plugin FAILED + " + lines[0]
lines.subList(1, lines.size()).forEach { line ->
println "#educational_plugin" + line
}
// we need this to separate output of different tests
println()
}
}
}
}
}
defaultConfig {
testInstrumentationRunner 'com.edu.AndroidEduTestRunner'
}
}
dependencies {
def robolectric = hs.android.robolectricVersion
testImplementation "org.robolectric:robolectric:$robolectric"
def junit = hs.android.lib.junit
testImplementation "junit:junit:$junit"
}
}
}
}
this is not the original file
the error you are having is this line
androidGradleVersion '7.2.0'
in groovy, which is the language of this file, this is giving the string '7.0.2' to the method androidGradleVersion, and this method does not exist . That is why the error says
Could not find method androidGradleVersion() for arguments [7.2.0]
copy the version that is on your main branch with commit redirecting hs-plugin link to release
Ok, now is working fine. Thanks
great, that is good news!
You made some alterations to the module gradle file, but there are some conflicting variables going on there currently
minSdkVersion is one minSdk is different targetSdkVersion is one targetSdk is another
also there are compileSdk and compileSdkVersion is it really needed having both? I could see that you really need compileSdkVersion to be 31 because of your extra dependencies, but I tested having this for stage1 and it worked
I'm not sure this will work for all stages, but avoid changing variables defined on hs.adroid unless you really need it. Also I think that having compileSdkVersion, minSdkVersion and targetSdkVersion is enough. I'll admit that sometimes I struggle with gradle config, but it looks odd to me having minSdk and minSdkVersion, why would we need two of those, can they be different, if yes then which is the real min, if no why not just one of those.
If you already know this second version is not going to work for future stages or if I'm missing or being wrong on some info please let me know.
Oh by the way the TODO should be gone