question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WindowLeaked com.android.internal.policy.PhoneWindow

See original GitHub issue
03-28 16:21:04.862 27263-27263/com.test.debug E/WindowManager: android.view.WindowLeaked: Activity com.test.MainActivity has leaked window com.android.internal.policy.PhoneWindow$DecorView{6b8b757 V.E...... R....... 0,0-1026,749} that was originally added here
                                                                             at android.view.ViewRootImpl.<init>(ViewRootImpl.java:566)
                                                                             at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:326)
                                                                             at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
                                                                             at android.app.Dialog.show(Dialog.java:350)
                                                                             at com.imagepicker.ImagePickerModule.showImagePicker(ImagePickerModule.java:182)
                                                                             at java.lang.reflect.Method.invoke(Native Method)
                                                                             at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:345)
                                                                             at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:136)
                                                                             at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
                                                                             at android.os.Handler.handleCallback(Handler.java:739)
                                                                             at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                             at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
                                                                             at android.os.Looper.loop(Looper.java:158)
                                                                             at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
                                                                             at java.lang.Thread.run(Thread.java:818)

react-native: 0.42.0 react-native-image-picker: 0.26.2 platform: Android

Hi, it was working fine when react-native was 0.38, but after the upgrade pressing Take a Photo will crash the app on Android and throw the error above. Thanks in advanced!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
JoelKapcommented, Jan 16, 2019

After an about 3 hours of sweating, I added these 2 lines in AndroidManifest.xml

<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

and worked like a charm

5reactions
jnrepocommented, Apr 23, 2017

I was able to fix the issue. Had to change my provider to look like this… (copied directly from android manifest in react-native-image-picker)

      <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true"
            tools:replace="android:authorities">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths"
                tools:replace="android:resource" />
        </provider>
Read more comments on GitHub >

github_iconTop Results From Across the Web

android activity has leaked window com.android.internal ...
WindowLeaked : Activity exp.app.NetErrorPage has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40534a18 that was ...
Read more >
MainActivity has leaked window com.android.internal ... - GitHub
Hello. When I start my app compiled in release mode I've got this error : Activity com.myapp.MainActivity has leaked window ...
Read more >
Activity has leaked window - Mobikul
WindowLeaked : Activity com.example.android has leaked window. com.android.internal.policy.PhoneWindow$DecorView{c75fa80 V.E…
Read more >
Activity has leaked window that was originally added - Wikitechy
WindowLeaked : Activity ccom.mypkg.myP has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@44c46ff0 that was originally added here 05-17 ...
Read more >
app.MainActivity has leaked window com.android.internal.policy
How to solve :Activity com.app.moko.MainActivity has leaked window com.android. internal. policy.impl. PhoneWindow --------that error appear ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found