打包时报错: The WIFI_SERVICE must be looked up on the Application context or memory will leak on devic
2018-01-29 15:03
746 查看
Error: The WIFI_SERVICE must be looked up on the Application context or memory will leak on devices < Android N. Try changing ac to ac.getApplicationContext() [WifiManagerLeak]
问题原因:
log上也说明了,在android N以上要用ac.getApplicationContext()来获取
所以解决办法也就很简单了:
改一下即可!
问题原因:
WifiManager wifi = (WifiManager) ac.getSystemService(Context.WIFI_SERVICE);
log上也说明了,在android N以上要用ac.getApplicationContext()来获取
所以解决办法也就很简单了:
WifiManager wifi = (WifiManager) ac.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
改一下即可!
相关文章推荐
- Android studio编译错误 Error: The WIFI_SERVICE must be looked up on the Application
- The WIFI_SERVICE must be looked up on the Application
- Android studio编译错误二:Error: The WIFI_SERVICE must be looked up on the Application
- Android studio编译错误二:Error: The WIFI_SERVICE must be looked up on the Application
- Android studio编译错误二:Error: The WIFI_SERVICE must be looked up on the Application
- The service cannot be activated because it does not support ASP.NET compatibility. ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the ser
- 2.23 Apps must follow the iOS Data Storage Guidelines or they will be rejected
- Logon: "You must be granted the Allow log on through the Terminal (or Remote Desktop) Services Right
- Apps must follow the iOS Data Storage Guidelines or they will be rejected
- org.hibernate.QueryException: addEntity() or addScalar() must be called on a sql query before executing the query
- 2.23 Apps must follow the iOS Data Storage Guidelines or they will be rejected
- 2.23 Apps must follow the iOS Data Storage Guidelines or they will be rejected
- 2.23 Apps must follow the iOS Data Storage Guidelines or they will be rejected
- org.hibernate.QueryException: addEntity() or addScalar() must be called on a sql query before executing the qury 问题的解决
- org.hibernate.QueryException: addEntity() or addScalar() must be called on a sql query before executing the query 问题的解决
- 2.23 Apps must follow the iOS Data Storage Guidelines or they will be rejected
- TypeError: view must be a callable or a list/tuple in the case of include()
- 【RAC搭建报错】PRVF-5507 : NTP daemon or service is not running on any node but NTP configuration file exists on the following node(s): rac02,rac01
- You are working on a database that must be functioning 24 hours a day, 7 days a week. The database i
- Debug error:"One or more breakpoints cannot be set and have been disabled.Execution will stop at the