If you don't see it there, use View > Tool Windows > Gradle. Go to File > Settings > Build, Execution, Deployment > Compiler.
Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. Each build configuration can define its own set of code and resources, while reusing the parts common to all versions of your app.
Android Studio projects contain a top-level project Gradle build file that allows you to add the configuration options common to all application modules in the project. Each application module also has its own build. gradle file for build settings specific to that module.
The following steps helps
project/.idea
~/.gradle
folder.Open the project again. Everything should be solved.
Thanks to free3dom for getting me on the right track here.
Diagnosis
The Sync Project with Gradle Files
option in Android Studio seems to keep the Project Structure
libraries up to date.
However, in my case there were some errors:
Expanding the (not very obvious) link showed the detail. My wire-runtime library was showing in an incorrect location:
This seemed to be a hangover from my original configuration where I had imported the JAR into a libs folder.
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
I subsequently changed it to be imported directly from Maven Central (as per here), and it seems that the old setting was never overwritten with the new one.
The Fix
The fix is to delete the library dependency from the Project Structure
screen and then Sync Project with Gradle Files
again.
More Detail
You can also see what path is being used to the resource by opening the .idea/libraries/wire_runtime_1_2_0.xml
directly.
My broken one was:
<component name="libraryTable">
<library name="wire-runtime-1.2.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/MY_MODULE/libs/wire-runtime-1.2.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
After deleting and re-adding the library it changed the root url
to:
<root url="jar://$USER_HOME$/.gradle/caches/artifacts-26/filestore/com.squareup.wire/wire-runtime/1.2.0/jar/44e7acbd5eb6f29698181dc3d67a60acf7efee80/wire-runtime-1.2.0.jar!/" />
Update
Android Studio v0.4.4 apparently fixes other bugs which have the same symptoms, so if you have an older version you may wish to upgrade.
Simple Solution
Go through the link and it worked for me.
File
option from menu on left top side of android studio.Invalidate Cache/Restart
It will open an dialog.Invalidate and Restart
It resolved my problem
Go to File > Invalidate Cache/Restart > Invalidate and Restart
Source here for youtube
1) Click on the gradle icon (right side on the android studio)
2) Click on the refresh button and wait for the issue to be resolved :D
I was still having the same problem with Android Studio v3.2.1 constantly, and sorted out the problem just removing these two sub-folders of the .idea
folder (no need to delete the whole .idea
folder) while a gradle sync didn't work:
./idea/caches
./idea/libraries
For me
deleting .gradle and .idea folder
of project solved the problem.
Just do this on your Android studio:
File -> Invalidate caches/Restart -> Invalidate and Restart
This worked for me. No need to clear ./gradle or ./idea folder
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With