直接使用demo2,多次进入就会出现泄漏,打印如下:
Activity location.demo.main has leaked IntentReceiver com.baidu.location.i$b@4a0da318 that was originally registered here. Are you missing a call to unregisterReceiver()? android.app.IntentReceiverLeaked: Activity location.demo.main has leaked IntentReceiver com.baidu.location.i$b@4a0da318 that was originally registered here. Are you missing a call to unregisterReceiver()? at android.app.ActivityThread$PackageInfo$ReceiverDispatcher.<init>(ActivityThread.java:939) at android.app.ActivityThread$PackageInfo.getReceiverDispatcher(ActivityThread.java:734) at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:797) at android.app.ContextImpl.registerReceiver(ContextImpl.java:784) at android.app.ContextImpl.registerReceiver(ContextImpl.java:778) at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:318) at com.baidu.location.i.<init>(Unknown Source) at com.baidu.location.LocationClient.<init>(Unknown Source) at location.demo.main.onCreate(main.java:30) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
Activity location.demo.main has leaked IntentReceiver com.baidu.location.i$b@4a0da318 that was originally registered here. Are you missing a call to unregisterReceiver()? android.app.IntentReceiverLeaked: Activity location.demo.main has leaked IntentReceiver com.baidu.location.i$b@4a0da318 that was originally registered here. Are you missing a call to unregisterReceiver()? at android.app.ActivityThread$PackageInfo$ReceiverDispatcher.<init>(ActivityThread.java:939) at android.app.ActivityThread$PackageInfo.getReceiverDispatcher(ActivityThread.java:734) at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:797) at android.app.ContextImpl.registerReceiver(ContextImpl.java:784) at android.app.ContextImpl.registerReceiver(ContextImpl.java:778) at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:318) at com.baidu.location.i.<init>(Unknown Source) at com.baidu.location.LocationClient.<init>(Unknown Source) at location.demo.main.onCreate(main.java:30) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)