0

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 Answers2

0

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.

Sam
  • 241
  • 3
  • 7
  • I tried with 1. Invalidating cache and restart 2. Reinstalled Android Studio Still, it showing the same error. – Pravinkumar Putta Oct 20 '20 at 09:08
  • @PravinkumarPutta install the low version, not 4.1. you can find on web easily. Use the version which you was using before and now uninstall android studio completely. because when there is no file on android is on your pc the new android studio creates its own and it work like a new. :) Cheer – Sam Oct 20 '20 at 09:15
  • Didn't found the previous version of the android studio. But tried once removing everything related to android studio. Now I'm getting another error i.e. `Could not create an instance of type org.gradle.plugin.management.internal.DefaultPluginResolutionStrategy. > Could not generate a decorated class for class org.gradle.plugin.management.internal.DefaultPluginResolutionStrategy. > loader (instance of org/gradle/initialization/MixInLegacyTypesClassLoader): attempted duplicate class definition for name: "org/gradle/plugin/management/internal/DefaultPluginResolutionStrategy_Decorated"` – Pravinkumar Putta Oct 20 '20 at 11:20
0

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