gpt4 book ai didi

android - 发现泄漏 : AndroidHttpClient created and never closed

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:28:22 24 4
gpt4 key购买 nike

我并没有真正实例化 AndroidHttpClient在我的代码中的任何位置,但我确实启动了一个识别器 Intent ,它在我的应用程序运行时的某个时刻产生了这个异常:

Leak found
java.lang.IllegalStateException: AndroidHttpClient created and never closed
at android.net.http.AndroidHttpClient.<init>(AndroidHttpClient.java:152)
at android.net.http.AndroidHttpClient.newInstance(AndroidHttpClient.java:138)
at com.google.android.voicesearch.speechservice.SpeechServiceHttpClient.<init>(SpeechServiceHttpClient.java:59)
at com.google.android.voicesearch.speechservice.ServerConnectorImpl.<init>(ServerConnectorImpl.java:85)
at com.google.android.voicesearch.VoiceSearchContainerImpl.createRecognitionController(VoiceSearchContainerImpl.java:83)
at com.google.android.voicesearch.GoogleRecognitionService.onCreate(GoogleRecognitionService.java:65)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2066)
at android.app.ActivityThread.access$2500(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3835)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
at dalvik.system.NativeStart.main(Native Method)

假设错误不在 Android 的代码中,而是在我的代码中,这个泄漏的资源可能只在以下之一中创建:

  1. SpeechRecognizer.createSpeechRecognizer()
  2. 新的 RecognitionListener()
  3. 新 Intent (SpeechRecognizer.RESULTS_RECOGNITION)
  4. SpeechRecognizer.startListening(recognizerIntent)

但是我怎么知道是哪一个呢?

最佳答案

Assuming the bug is not in Android's code but in mine

泄漏在 com.google.android.voicesearch 中,这不是您的代码。

如果您可以创建一个小型示例项目来演示此泄漏,我们可以将问题提交给 Google,希望他们能够解决。

关于android - 发现泄漏 : AndroidHttpClient created and never closed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7891047/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com