Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android-Studio refresh project with build.gradle changes

how can I sync changes I made in the build.gradle into the project structure ( e.g. that AndroidStudio is recognizing the lib I added? Kind of like the "reimport all maven projects" for maven projects - just for a pure gradle project.

like image 770
ligi Avatar asked May 18 '13 12:05

ligi


People also ask

How do I force Gradle to sync?

Open your gradle. properties file in Android Studio. Restart Android Studio for your changes to take effect. Click Sync Project with Gradle Files to sync your project.

How do I update my project level build Gradle to latest version?

You can specify the Gradle version in either the File > Project Structure > Project menu in Android Studio, or update your Gradle version using the command line. The preferred way is to use the Gradle Wrapper command line tool, which updates the gradlew scripts.

How do I reset build Gradle?

Android studio -> Settings -> build tools -> gradle -> Project-level settings -> select Use default gradle wrapper(recommended). And sync gradle and rebuild your project.


4 Answers

I read somewhere that the "Synchronize" item on the module's context menu should update the IDE's settings based on the build.gradle file.

Ok, so in the latest version of Android Studio 0.1.3, they've added a Gradle project refresh button next to the other Android specific buttons in the toolbar. Make changes manually to the build.gradle files and settings.gradle and then click this button. It should configure and refresh your project settings based on the gradle files.

like image 68
GrkEngineer Avatar answered Oct 14 '22 07:10

GrkEngineer


One thing that has worked for me was opening the Gradle panel on the right side of the editor (above "Maven Projects" and "Commander") and clicking the refresh button. That refreshed the module settings.

like image 10
Matteo Danieli Avatar answered Oct 14 '22 06:10

Matteo Danieli


For Android Studio 4.1.2 click on the button pointed on picture

enter image description here

like image 2
Panagiotis Bougioukos Avatar answered Oct 14 '22 08:10

Panagiotis Bougioukos


My solution for newer version of Android Studio. Tested on version 3.2.1. You can selected Refresh from the menu as showing here:
enter image description here

like image 1
us_david Avatar answered Oct 14 '22 07:10

us_david