I installed flutter and dart, on windows the project starts and works normally, but when trying to build and run it under android 8 gradle errors. FLutter doctor shows no errors.
Launching libmain.dart on RMX3363 in debug mode...
e: D:Programsflutterflutterpackagesflutter_toolsgradlesettings.gradle.kts:1:1: Unresolved reference: dependencyResolutionManagement
e: D:Programsflutterflutterpackagesflutter_toolsgradlesettings.gradle.kts:1:1: Cannot access implicit script receiver class 'org.gradle.api.initialization.Settings'. Check your module classpath for missing or conflicting dependencies
e: D:Programsflutterflutterpackagesflutter_toolsgradlesettings.gradle.kts:2:3: Unresolved reference: repositoriesMode
e: D:Programsflutterflutterpackagesflutter_toolsgradlesettings.gradle.kts:2:24: Unresolved reference: RepositoriesMode
e: D:Programsflutterflutterpackagesflutter_toolsgradlesettings.gradle.kts:3:3: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun Project.repositories(configuration: RepositoryHandler.() -> Unit): Unit defined in org.gradle.kotlin.dsl
public fun ScriptHandler.repositories(configuration: RepositoryHandler.() -> Unit): Unit defined in org.gradle.kotlin.dsl
e: D:Programsflutterflutterpackagesflutter_toolsgradlesettings.gradle.kts:4:5: Unresolved reference: google
e: D:Programsflutterflutterpackagesflutter_toolsgradlesettings.gradle.kts:5:5: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public inline fun RepositoryHandler.mavenCentral(vararg args: Pair<String, Any?>): MavenArtifactRepository defined in org.gradle.kotlin.dsl
e: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class org.gradle.kotlin.dsl.support.CompiledKotlinSettingsScript, unresolved supertypes: org.gradle.api.plugins.PluginAware
class org.gradle.kotlin.dsl.support.DefaultKotlinScript, unresolved supertypes: org.gradle.internal.scripts.GradleScript
Adding -Xextended-compiler-checks argument might provide additional information.
FAILURE: Build failed with an exception.
* Where:
Settings file 'D:Programsflutterflutterpackagesflutter_toolsgradlesettings.gradle.kts' line: 1
* What went wrong:
Script compilation errors:
Line 1: dependencyResolutionManagement {
^ Unresolved reference: dependencyResolutionManagement
Line 1: dependencyResolutionManagement {
^ Cannot access implicit script receiver class 'org.gradle.api.initialization.Settings'. Check your module classpath for missing or conflicting dependencies
Line 2: repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)
^ Unresolved reference: repositoriesMode
Line 2: repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)
^ Unresolved reference: RepositoriesMode
Line 3: repositories {
^ Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun Project.repositories(configuration: RepositoryHandler.() -> Unit): Unit defined in org.gradle.kotlin.dsl
public fun ScriptHandler.repositories(configuration: RepositoryHandler.() -> Unit): Unit defined in org.gradle.kotlin.dsl
Line 4: google()
^ Unresolved reference: google
Line 5: mavenCentral()
^ Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public inline fun RepositoryHandler.mavenCentral(vararg args: Pair<String, Any?>): MavenArtifactRepository defined in org.gradle.kotlin.dsl
Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class org.gradle.kotlin.dsl.support.CompiledKotlinSettingsScript, unresolved supertypes: org.gradle.api.plugins.PluginAware
class org.gradle.kotlin.dsl.support.DefaultKotlinScript, unresolved supertypes: org.gradle.internal.scripts.GradleScript
Adding -Xextended-compiler-checks argument might provide additional information.
8 errors
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (1).
Install old version of android studio
2
Answers
The problem is that I get the message that there is no Properties class.
it’s hard to tell exactly what’s the problem, but this looks suspicious:
Why would you that?
Anyway, the "Unresolved reference" errors you’re experiencing are likely caused by using a version of Gradle that’s too old. For example, if you look at dependenciesResolutionManagement docs page, you’ll see it’s available since Gradle 6.8 – make sure you’re using that or newer version. See also this comment for guidance on how to update Gradle.