Reputation: 577
I have created a Flutter project in Android Studio. The project was working fine until I opened the app-level Gradle file as when I open is starts showing two errors: 1) 'Cannot resolve symbol Properties' and 2) 'cannot resolve symbol GradleException'
I click on "Open for editing in Android studio" and the error 1) disappeared, but 'cannot resolve symbol GradleException' is still there. I have the latest Gradle and Android Studio. The project was working fine until I opened this app-level Gradle file.
Upvotes: 50
Views: 52737
Reputation: 63
Sometimes the IDE can attack itself. To do this, change the folder named android (in the project location path) to OLDandroid.
Then, re-set your project as an android project via the IDE. (For VS Code: there is the phrase "set as android project" right under the emulator selection menu).
The IDE will create a new android folder for you at this stage. You can then move the necessary code blocks from the OLDandroid folder into the new android folder (manifests.xml, res, build properties, release keys etc.) and run the project.
If you are done with the OLDandroid folder, you can delete it.
Upvotes: 0
Reputation: 857
You need to upgrade your SDK's version to the latest ones in your build.gradle at the app level.
Upvotes: -2
Reputation: 11
I removed the 'new' keyword, and everything is worked. Don't forget to keep your IDE up-to-date all the time.
Upvotes: -1
Reputation: 1341
It sounds like an IDE issue. Restart Android Studio, but going to menu File → Invalidate Caches / Restart. This happens to me when I synchronise Gradle after updates sometimes
Upvotes: 6
Reputation: 635
Use:
throw GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
I tried by removing the "new" keyword and it somehow worked for me.
I changed
throw new GradleException
to
throw GradleException.
Upvotes: 53
Reputation: 857
Set Project SDK to Android API Platform version 29 (or the latest version, 30), like so:
defaultConfig {
...
minSdkVersion 16
targetSdkVersion 30
}
And update GradleException()
to FileNotFoundException()
.
Please follow this: Have a problem on Cannot resolve symbol for properties and Gradle exception #29608
This works for me.
Upvotes: 76
Reputation: 399
Open build.gradle file and set targetSdkVersion
and compileSdkVersion
to 29
Click on File => Project Structure => Project then set Project SDK to Android API 29 platform
In project structure => Module and select dependencies in the right column and then set Module SDK to Android API 29 platform
Now open build.gradle and replace GradleException
with FileNotFoundException
Upvotes: 11