Search code examples
androidandroid-studioandroid-ndkstack-overflow

How can I fix constant freezes in Android Studio due to a StackOverflowError on Android NDK Support?


I am running Android Studio 3.0.1 on Windows 10 64-bit.

Lately Android Studio freezes constantly. After it recovers, I can see an IDE Fatal Error report, caused by a stackoverflow error on NDK Support.

Details:

I set up my own NDK (ndk-r17c) specified in Project Structure Android NDK Location and in the environment variables: ANDROID_NDK and ANDROID_NDK_HOME I am using the default Android NDK Support plugin version 1.0

Here is a stack trace of the problem

null
java.lang.StackOverflowError
    at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.appendPathOnFileSystem(VirtualFileSystemEntry.java:170)
    at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.appendPathOnFileSystem(VirtualFileSystemEntry.java:170)
    at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.appendPathOnFileSystem(VirtualFileSystemEntry.java:170)
    at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.appendPathOnFileSystem(VirtualFileSystemEntry.java:170)
    at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.appendPathOnFileSystem(VirtualFileSystemEntry.java:170)
    at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.appendPathOnFileSystem(VirtualFileSystemEntry.java:170)
    at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.appendPathOnFileSystem(VirtualFileSystemEntry.java:170)
    at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.appendPathOnFileSystem(VirtualFileSystemEntry.java:170)
    at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.appendPathOnFileSystem(VirtualFileSystemEntry.java:170)
    at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.appendPathOnFileSystem(VirtualFileSystemEntry.java:170)
    at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.appendPathOnFileSystem(VirtualFileSystemEntry.java:170)
    at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.appendPathOnFileSystem(VirtualFileSystemEntry.java:170)
    at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.getUrl(VirtualFileSystemEntry.java:189)
    at com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile(VfsUtilCore.java:389)
    at com.android.tools.ndk.GradleWorkspace.getConfigurationsForFile(GradleWorkspace.java:541)
    at com.android.tools.ndk.NdkCompilerInfoCache.getCompilerInfo(NdkCompilerInfoCache.java:56)
    at com.android.tools.ndk.ModuleResolveConfiguration.getNdkCompilerInfo(ModuleResolveConfiguration.java:167)
    at com.android.tools.ndk.ModuleResolveConfiguration.getLibraryHeadersRoots(ModuleResolveConfiguration.java:157)
    at com.android.tools.ndk.GradleWorkspace.getConfigurationsForFile(GradleWorkspace.java:538)
    at com.android.tools.ndk.NdkCompilerInfoCache.getCompilerInfo(NdkCompilerInfoCache.java:56)
    at com.android.tools.ndk.ModuleResolveConfiguration.getNdkCompilerInfo(ModuleResolveConfiguration.java:167)
    at com.android.tools.ndk.ModuleResolveConfiguration.getLibraryHeadersRoots(ModuleResolveConfiguration.java:157)
    at com.android.tools.ndk.GradleWorkspace.getConfigurationsForFile(GradleWorkspace.java:538)
    at com.android.tools.ndk.NdkCompilerInfoCache.getCompilerInfo(NdkCompilerInfoCache.java:56)
    at com.android.tools.ndk.ModuleResolveConfiguration.getNdkCompilerInfo(ModuleResolveConfiguration.java:167)
    at com.android.tools.ndk.ModuleResolveConfiguration.getLibraryHeadersRoots(ModuleResolveConfiguration.java:157)

From that point on,the stacktrace repeats several times until, of course, there is a stack overflow

Attempts to fix:

I have already tried rebooting and invalidating cache, but it does not help.


Solution

  • Updating to 3.2.1 solves the issue