Unable run existing projects and newly created project after updating Android Studio to 4.1

226 Views Asked by At

I have recently updated the android studio and all plugins.

while trying to run my existing projects it's showing the below error

Unable to find method 'com.google.common.collect.ImmutableSet.builderWithExpectedSize(I)Lcom/google/common/collect/ImmutableSet$Builder;'
com.google.common.collect.ImmutableSet.builderWithExpectedSize(I)Lcom/google/common/collect/ImmutableSet$Builder;

Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.

Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

Showing the same error after creating new project.

Tried with below options shown by Android Studio, but didn't worked.

  1. Re-download dependencies and sync project (requires network)
  2. Stop Gradle build processes (requires restart)

Did anyone faced this issue or if anyone knows how to solve this issue? Please help me. My complete work got stuck because of this.

2

There are 2 best solutions below

3
On

What I recommend you is to go to files and select invalide and restart (you will find something like that). If your problem has not been sort. Then uninstall the android studio but keep it in mind when you are uninstalling it only removes the setting, not the whole. The android studio asks you about this. So in this way within a few minutes you will be back to android studio and your AVD are also there.

0
On

Finally, it worked by executing the below commands and reinstalling Android Studio Freshly.

# Deletes the Android Studio application
# Note that this may be different depending on what you named the application as, or whether you downloaded the preview version
rm -rf /Applications/Android\ Studio.app
# Delete All Android Studio related preferences
# The asterisk here should target all folders/files beginning with the string before it
rm -rf ~/Library/Preferences/AndroidStudio*
# Deletes the Android Studio's plist file
rm -rf ~/Library/Preferences/com.google.android.*
# Deletes the Android Emulator's plist file
rm -rf ~/Library/Preferences/com.android.*
# Deletes mainly plugins (or at least according to what mine (Edric) contains)
rm -rf ~/Library/Application\ Support/AndroidStudio*
rm -rf ~/Library/Application\ Support/Google/AndroidStudio*
# Deletes all logs that Android Studio outputs
rm -rf ~/Library/Logs/AndroidStudio*
rm -rf ~/Library/Logs/Google/AndroidStudio*
# Deletes Android Studio's caches
rm -rf ~/Library/Caches/AndroidStudio*
rm -rf ~/Library/Caches/Google/AndroidStudio*
# Deletes older versions of Android Studio
rm -rf ~/.AndroidStudio*
# Deletes projects
rm -rf ~/AndroidStudioProjects
# Delete all gradle plugins
rm -rf ~/.gradle
# Delete all avds
rm -rf ~/.android
# Delete sdk tools
rm -rf ~/Library/Android*
# delete Emulator Console Auth Token
rm -rf ~/.emulator_console_auth_token