Android 8 Settings app crashes on emulator with clean AOSP build

I managed to fix it myself. The problem seems to be due to com.android.settings.wfd.WifiDisplaySettings.isAvailable reporting that WiFi is available, while wifip2p service is absent. I went to WifiDisplaySettings.java:216 and replaced this check with false, so it won't try to locate the service. Now Settings can be opened properly.


Alter your WifiDisplaySettings.java in

/YoutAospRoot/packages/apps/Settings/src/com/android/settings/wfd/WifiDisplaySettings.java

Change the code snippet

public static boolean isAvailable(Context context) {
        return context.getSystemService(Context.DISPLAY_SERVICE) != null
                && context.getSystemService(Context.WIFI_P2P_SERVICE) != null;
}

To

public static boolean isAvailable(Context context) {
    return false;
}

Then

make systemimage