I have a problem after using Shared Preferences version 2.1.0 on Android env (emulator).
The problem is stated like this (thank you very much if you are willing to answer my question) :
What went wrong:
A problem occurred configuring project ':shared_preferences_android'.
> Could not load compiled classes for build file 'C:UsersrakhtamaAppDataLocalPubCachehostedpub.devshared_preferences_android-2.1.0androidbuild.gradle' from cache.
> Failed to notify project evaluation listener.
> Could not get unknown property 'android' for project ':shared_preferences_android' of type org.gradle.api.Project.
> Could not get unknown property 'android' for project ':shared_preferences_android' of type org.gradle.api.Project.
And this is files related to the error :
C:UsersrakhtamaAppDataLocalPubCachehostedpub.devshared_preferences_android-2.1.0androidbuild.gradle :
group 'io.flutter.plugins.sharedpreferences'
version '1.0-SNAPSHOT'
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
}
}
rootProject.allprojects {
repositories {
google()
mavenCentral()
}
}
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 33
defaultConfig {
minSdkVersion 16
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency'
baseline file("lint-baseline.xml")
}
dependencies {
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-inline:5.0.0'
}
testOptions {
unitTests.includeAndroidResources = true
unitTests.returnDefaultValues = true
unitTests.all {
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
outputs.upToDateWhen {false}
showStandardStreams = true
}
}
}
}
{project-folder}androidgradlewrappergradler-wrapper.properties
{project-folder}androidbuild.gradle :
{project-folder}androidgradle.properties :
Thank you very much if you are willing to answer my question.
I have tried to run "flutter clean" & ".gradlew clean build" but the error stil exist.
2
Answers
Just follow the below step, it will be resolved,
RUN
flutter clean
in the terminalPug get from pubspec.yamal