Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android 8 Settings app crashes on emulator with clean AOSP build

"Settings" app will crash immediately after open with clean Android 8 build (aosp_x86-eng) on emulator. logcat output is below:

--------- beginning of main
1536  1550 E memtrack: Couldn't load memtrack module
1536  1550 W android.os.Debug: failed to get memory consumption info: -1
--------- beginning of system
1536  1548 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.settings/.Settings (has extras)} from uid 10013
1373  2321 W audio_hw_generic: Not supplying enough data to HAL, expected position 926726 , only wrote 926722
2477  2477 W zygote  : Unexpected CPU variant for X86 using defaults: x86
1536  1548 I ActivityManager: Start proc 2477:com.android.settings/1000 for activity com.android.settings/.Settings
2477  2477 I zygote  : The ClassLoaderContext is a special shared library.
2477  2477 D OpenGLRenderer: HWUI GL Pipeline
2477  2477 W TileUtils: Found com.android.settings.backup.BackupSettingsActivity for intent Intent { act=com.android.settings.action.SETTINGS pkg=com.android.settings } missing metadata com.android.settings.category
2477  2477 D ConditionManager: conditions loading asychronously
2477  2496 D ConditionManager: loading conditions from xml
2477  2495 E BluetoothAdapter: Bluetooth binder is null
2477  2495 V NFC     : this device does not have NFC support
1388  1836 E SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
2477  2500 D SuggestionParser: Day 0 for com.android.settings.suggested.category.FIRST_IMPRESSION
2477  2495 D BatteryInfo: time to make batteryStatsHelper: 1ms
1536  1554 I WifiService: requestActivityInfo uid=1000
1536  1554 I WifiService: reportActivityInfo uid=1000
1536  1554 I WifiService: getSupportedFeatures uid=1000
1536  1606 W HalDeviceManager: isWifiStarted called but mWifi is null!?
2477  2500 I SuggestionParser: Use fingerprint requires unavailable feature android.hardware.fingerprint
1536  1554 E BluetoothAdapter: Bluetooth binder is null
1536  1554 E BatteryExternalStatsWorker: no controller energy info supplied for wifi
1536  1554 E KernelCpuSpeedReader: Failed to read cpu-freq: /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state (No such file or directory)
1536  1554 E BatteryExternalStatsWorker: modem info is invalid: ModemActivityInfo{ mTimestamp=0 mSleepTimeMs=0 mIdleTimeMs=0 mTxTimeMs[]=[0, 0, 0, 0, 0] mRxTimeMs=0 mEnergyUsed=0}
2477  2500 I SuggestionParser: Add another fingerprint requires unavailable feature android.hardware.fingerprint
2477  2495 D BatteryInfo: time for getStats: 10ms
2477  2500 W TileUtils: Found com.android.settings.backup.BackupSettingsActivity for intent Intent { act=com.android.settings.action.SETTINGS pkg=com.android.settings } missing metadata com.android.settings.category
1643  1852 D EGL_emulation: eglMakeCurrent: 0x945dab60: ver 2 0 (tinfo 0x945e4970)
1380  1380 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 1540096
1380  1525 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 1540096
2477  2499 D         : HostConnection::get() New Host Connection established 0xa750eb00, tid 2499
2477  2499 I zygote  : android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2477  2499 I OpenGLRenderer: Initialized EGL, version 1.4
2477  2499 D OpenGLRenderer: Swap behavior 1
2477  2500 E SystemServiceRegistry: No service published for: wifip2p
2477  2500 E SystemServiceRegistry: android.os.ServiceManager$ServiceNotFoundException: No service published for: wifip2p
2477  2500 E SystemServiceRegistry:     at android.os.ServiceManager.getServiceOrThrow(ServiceManager.java:75)
2477  2500 E SystemServiceRegistry:     at android.app.SystemServiceRegistry$49.createService(SystemServiceRegistry.java:569)
2477  2500 E SystemServiceRegistry:     at android.app.SystemServiceRegistry$49.createService(SystemServiceRegistry.java:567)
2477  2500 E SystemServiceRegistry:     at android.app.SystemServiceRegistry$StaticServiceFetcher.getService(SystemServiceRegistry.java:987)
2477  2500 E SystemServiceRegistry:     at android.app.SystemServiceRegistry.getSystemService(SystemServiceRegistry.java:914)
2477  2500 E SystemServiceRegistry:     at android.app.ContextImpl.getSystemService(ContextImpl.java:1667)
2477  2500 E SystemServiceRegistry:     at android.view.ContextThemeWrapper.getSystemService(ContextThemeWrapper.java:171)
2477  2500 E SystemServiceRegistry:     at android.app.Activity.getSystemService(Activity.java:5915)
2477  2500 E SystemServiceRegistry:     at com.android.settings.wfd.WifiDisplaySettings.isAvailable(WifiDisplaySettings.java:216)
2477  2500 E SystemServiceRegistry:     at com.android.settings.SettingsActivity.doUpdateTilesList(SettingsActivity.java:845)
2477  2500 E SystemServiceRegistry:     at com.android.settings.SettingsActivity.-wrap0(Unknown Source:0)
2477  2500 E SystemServiceRegistry:     at com.android.settings.SettingsActivity$5.run(SettingsActivity.java:747)
2477  2500 E SystemServiceRegistry:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
2477  2500 E SystemServiceRegistry:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
2477  2500 E SystemServiceRegistry:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
2477  2500 E SystemServiceRegistry:     at java.lang.Thread.run(Thread.java:764)
1536  1548 W ActivityManager:   Force finishing activity com.android.settings/.Settings
1536  1552 I ActivityManager: Showing crash dialog for package com.android.settings u0

It seems that crash is somehow related to WiFi, but Android emulator shouldn't have WiFi support anyway. What could be the issue here?

like image 773
Thunderbeef Avatar asked Dec 15 '17 21:12

Thunderbeef


People also ask

Why Does My Settings app keep closing Android?

1. Close Recent/Unused Apps. One of the major reasons why the Settings app crashes on Android is due to the unavailability of sufficient RAM. Like every other app on your device, Settings also require a certain amount of RAM to function efficiently.

Why is app crashes in emulator Android studio?

An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java or Kotlin crashes if it throws an unhandled exception, represented by the Throwable class.

Why does my game keep crashing Android?

Why Do Android Apps Keep Crashing? Here are the main reasons why does an app keeps closing: Apps were installed or updated improperly. You may just update your Android device software but fail to update and install the apps from the Google Play store.

How do you troubleshoot the Android application which is crashing frequently in Android Studio?

The easiest way to fix an app that keeps crashing on your Android smartphone is to simply force stop it and open it again. To do this, go to Settings -> Apps and select the app that keeps crashing. Tap on the app's name and then tap on 'Force stop'. Now try opening the app again and see if it works well.


2 Answers

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.

like image 176
Thunderbeef Avatar answered Nov 15 '22 19:11

Thunderbeef


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 
like image 44
i love jack Avatar answered Nov 15 '22 18:11

i love jack