Error:Could not initialize class com.android.ide.common.util.ReadWriteProcessLock after updating to A.S. 2.4

After upgrading to Android Studio 2.4 Preview 4 I got this error

Error:Could not initialize class com.android.ide.common.util.ReadWriteProcessLock

  • Filling Color in polygon while points intersecting in Android
  • Logcat standalone client
  • Why to use Service if it runs in the same thread in android
  • My current location always returns null. How can I fix this?
  • Twitter How to get user profile pic using Fabric plugin in android Studio(Fixed)
  • Bitmap getWidth returns wrong value
  • Related posts:

    How to delete an SMS from the inbox in Android programmatically?
    front camera take very dark capture in android
    How to access EGL Image directly from Android Surface for use in MediaCodec video decoder?
    Unable to create Android AVD because of Target and CPU/ABI settings?
    How to swipe to delete a Card (using appcompat v7's CardView)
    Upgrade to phonegap 3.3.0
  • Sharing cookies from webview with BasicHttpRequest on Android
  • Android Bluetooth LE connection issue
  • Java.exe finished with non-zero exit value 2 in Android Studio
  • Android Studio setup JDK error
  • Implementing SearchView in action bar
  • Best way to add Activity to an Android project in Eclipse?
  • 4 Solutions collect form web for “Error:Could not initialize class com.android.ide.common.util.ReadWriteProcessLock after updating to A.S. 2.4”

    After some research, I found out it’s a known bug and fortunately, the solution is very simple.

    from release notes:

    After updating the Android plugin version, you need to stop the Gradle daemon to apply the update (Issue 267099). Otherwise, Gradle sync and builds fail with the following error:

    Could not initialize class com.android.ide.common.util.ReadWriteProcessLock, Failed to notify build listener or java.lang.ExceptionInInitializerError.

    To stop the daemon, you can either:

    1- restart Android Studio,

    or

    2- enter the following command in the IDE’s Terminal window: ./gradlew --stop or for windows gradlew --stop

    Gradle restarts the daemon for you the next time you sync or build your
    project.

    The best way is Invalidate / cache restart or open terminal and type

    ./gradlew --stop
    

    For windows

    gradlew --stop
    

    This issue is arising in 2.4 version 4 and above to solve this issue you need to stop the Gradle daemon to apply the update (Issue 267099). Otherwise, Gradle sync and builds fail with the following error: Could not initialize class com.android.ide.common.util.ReadWriteProcessLock, Failed to notify build listener, or java.lang.ExceptionInInitializerError.
    To stop the daemon, you can either restart Android Studio, or enter the following command in the IDE’s Terminal window: ./gradlew –stop.
    Gradle restarts the daemon for you the next time you sync or build your project.

    For more information/Source-https://androidstudio.googleblog.com/2017/04/android-studio-24-preview-4-is-now.html

    Another convenient method:

    Android Studio -> File -> Invalidate Caches / Restart… -> Invalidate and Restart

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.