最近做从android9.0到11.0的代码移植工作,需要在WifiManager.java中添加接口,添加以后编译报错:
frameworks/base/wifi/java/android/net/wifi/WifiManager.java:5703: error: Missing nullability on parameter `cmd` in method `****` [MissingNullability]
frameworks/base/wifi/java/android/net/wifi/WifiManager.java:5711: error: Missing nullability on method `****` return [MissingNullability]
frameworks/base/wifi/java/android/net/wifi/WifiManager.java:5711: error: Missing nullability on parameter `cmd` in method `****` [MissingNullability]
解决办法是需要在frameworks/base/wifi/api/lint-baseline.txt里面添加:
MissingNullability: android.net.wifi.WifiManager#函数名(String, int) parameter #0:
Missing nullability on parameter `参数` in method `函数名`