Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashing app on first time when Android ask permission. Logcat inside. #126

Open
claudioviola opened this issue Feb 1, 2016 · 18 comments
Open

Comments

@claudioviola
Copy link

When try to open first time the album whit plugin the app crash and close sudnley.
The adb logcat report fllow lines.
Is it my fault?

02-01 22:12:05.709 778 966 I ActivityManager: START u0 {cmp=purple.alpha.app/com.synconset.MultiImageChooserActivity (has extras)} from uid 10174 on display 0
02-01 22:12:05.774 937 9461 E DatabaseUtils: Writing exception to parcel
02-01 22:12:05.774 937 9461 E DatabaseUtils: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=16354, uid=10174 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
02-01 22:12:05.774 937 9461 E DatabaseUtils: at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:605)
02-01 22:12:05.774 937 9461 E DatabaseUtils: at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:480)
02-01 22:12:05.774 937 9461 E DatabaseUtils: at android.content.ContentProvider$Transport.query(ContentProvider.java:211)
02-01 22:12:05.774 937 9461 E DatabaseUtils: at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
02-01 22:12:05.774 937 9461 E DatabaseUtils: at android.os.Binder.execTransact(Binder.java:453)
02-01 22:12:05.776 937 9458 E DatabaseUtils: Writing exception to parcel
02-01 22:12:05.776 937 9458 E DatabaseUtils: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=16354, uid=10174 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
02-01 22:12:05.776 937 9458 E DatabaseUtils: at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:605)
02-01 22:12:05.776 937 9458 E DatabaseUtils: at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:480)
02-01 22:12:05.776 937 9458 E DatabaseUtils: at android.content.ContentProvider$Transport.query(ContentProvider.java:211)
02-01 22:12:05.776 937 9458 E DatabaseUtils: at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
02-01 22:12:05.776 937 9458 E DatabaseUtils: at android.os.Binder.execTransact(Binder.java:453)
02-01 22:12:05.779 16354 16379 I Process : Sending signal. PID: 16354 SIG: 9
02-01 22:12:05.845 778 876 W InputDispatcher: channel '6a473c9 purple.alpha.app/purple.alpha.app.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
02-01 22:12:05.845 778 876 E InputDispatcher: channel '6a473c9 purple.alpha.app/purple.alpha.app.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
02-01 22:12:05.848 778 876 W InputDispatcher: channel '7c4d500 purple.alpha.app/com.synconset.MultiImageChooserActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
02-01 22:12:05.848 778 876 E InputDispatcher: channel '7c4d500 purple.alpha.app/com.synconset.MultiImageChooserActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
02-01 22:12:05.852 778 789 I WindowState: WIN DEATH: Window{7c4d500 u0 purple.alpha.app/com.synconset.MultiImageChooserActivity}
02-01 22:12:05.852 778 789 W InputDispatcher: Attempted to unregister already unregistered input channel '7c4d500 purple.alpha.app/com.synconset.MultiImageChooserActivity (server)'
02-01 22:12:05.854 778 1989 D GraphicsStats: Buffer count: 4
02-01 22:12:05.854 778 2008 I WindowState: WIN DEATH: Window{6a473c9 u0 purple.alpha.app/purple.alpha.app.MainActivity}
02-01 22:12:05.854 778 2008 W InputDispatcher: Attempted to unregister already unregistered input channel '6a473c9 purple.alpha.app/purple.alpha.app.MainActivity (server)'
02-01 22:12:05.870 778 1592 I ActivityManager: Process purple.alpha.app (pid 16354) has died
02-01 22:12:05.871 778 1592 W ActivityManager: Force removing ActivityRecord{7301394 u0 purple.alpha.app/com.synconset.MultiImageChooserActivity t656}: app died, no saved state
02-01 22:12:05.871 778 1592 W ActivityManager: Force removing ActivityRecord{68ae170 u0 purple.alpha.app/.MainActivity t656}: app died, no saved state
02-01 22:12:05.918 778 788 W InputMethodManagerService: Got RemoteException sending setActive(false) notification to pid 16354 uid 10174
02-01 22:12:05.919 1893 1893 I Keyboard.Facilitator: onFinishInput()
02-01 22:12:06.350 778 799 W WindowAnimator: Failed to dispatch window animation state change.
02-01 22:12:06.350 778 799 W WindowAnimator: android.os.DeadObjectException
02-01 22:12:06.350 778 799 W WindowAnimator: at android.os.BinderProxy.transactNative(Native Method)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.os.BinderProxy.transact(Binder.java:503)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.view.IWindow$Stub$Proxy.onAnimationStopped(IWindow.java:534)
02-01 22:12:06.350 778 799 W WindowAnimator: at com.android.server.wm.WindowAnimator.updateWindowsLocked(WindowAnimator.java:286)
02-01 22:12:06.350 778 799 W WindowAnimator: at com.android.server.wm.WindowAnimator.animateLocked(WindowAnimator.java:678)
02-01 22:12:06.350 778 799 W WindowAnimator: at com.android.server.wm.WindowAnimator.-wrap0(WindowAnimator.java)
02-01 22:12:06.350 778 799 W WindowAnimator: at com.android.server.wm.WindowAnimator$1.doFrame(WindowAnimator.java:123)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:856)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.view.Choreographer.doCallbacks(Choreographer.java:670)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.view.Choreographer.doFrame(Choreographer.java:603)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.os.Handler.handleCallback(Handler.java:739)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.os.Handler.dispatchMessage(Handler.java:95)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.os.Looper.loop(Looper.java:148)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.os.HandlerThread.run(HandlerThread.java:61)
02-01 22:12:06.350 778 799 W WindowAnimator: at com.android.server.ServiceThread.run(ServiceThread.java:46)
02-01 22:12:06.350 778 799 W WindowAnimator: Failed to dispatch window animation state change.
02-01 22:12:06.350 778 799 W WindowAnimator: android.os.DeadObjectException
02-01 22:12:06.350 778 799 W WindowAnimator: at android.os.BinderProxy.transactNative(Native Method)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.os.BinderProxy.transact(Binder.java:503)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.view.IWindow$Stub$Proxy.onAnimationStopped(IWindow.java:534)
02-01 22:12:06.350 778 799 W WindowAnimator: at com.android.server.wm.WindowAnimator.updateWindowsLocked(WindowAnimator.java:286)
02-01 22:12:06.350 778 799 W WindowAnimator: at com.android.server.wm.WindowAnimator.animateLocked(WindowAnimator.java:678)
02-01 22:12:06.350 778 799 W WindowAnimator: at com.android.server.wm.WindowAnimator.-wrap0(WindowAnimator.java)
02-01 22:12:06.350 778 799 W WindowAnimator: at com.android.server.wm.WindowAnimator$1.doFrame(WindowAnimator.java:123)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:856)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.view.Choreographer.doCallbacks(Choreographer.java:670)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.view.Choreographer.doFrame(Choreographer.java:603)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.os.Handler.handleCallback(Handler.java:739)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.os.Handler.dispatchMessage(Handler.java:95)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.os.Looper.loop(Looper.java:148)
02-01 22:12:06.350 778 799 W WindowAnimator: at android.os.HandlerThread.run(HandlerThread.java:61)
02-01 22:12:06.350 778 799 W WindowAnimator: at com.android.server.ServiceThread.run(ServiceThread.java:46)

@dryruner
Copy link

+1, same issue found.
I'm also using $cordovaCamera plugin along with $cordovaImagePicker plugin. If I choose to take a picture from camera (using $cordovaCamera plugin), it prompts me a dialogue to request for permisson. If I deny that request, and then choosing to browse my gallery (using $cordovaImagePicker plugin), it crashes.
However, if I do give that permission, any following steps go smoothly.

@Findiglay
Copy link

+1 also getting crashes now with Android 6.0.1 when trying to use the image picker. Permissions are not being requested when launching the image picker it seems.

@freiserg
Copy link

Have you tried to add this code #127 (comment) in config.xml?

@Findiglay
Copy link

This above solution does not solve the issue. The build goes fine and the app is working. There is no permissions priming being fired for access to images (e.g. Do you want to allow access to your files?), however, and it seems when I try to launch the plugin without permissions given, a crash occurs.

If I go into settings/applications and allow all permissions there, the image picker can then launch without a crash.

@claudioviola
Copy link
Author

Months ago I tried window.plugins.ImagePicker and not window.ImagePicker.
window.plugins.ImagePicker exists - so changing to that would probably fix it for now at least on Android
At moment I'm not focus on picker image feature on my project, when I come back on it I can track again my log

@Findiglay
Copy link

I've just tested Poocart's pull request, which fixes the issue for me. There is a native permissions popup and denying permission will no longer crash the app.

@mohanchalla
Copy link

@Findiglay Hi! is that solution is working fine for you without any issues. Even I am also facing the same issue.

@Findiglay
Copy link

@mohanchalla Yes, its working without any problems so far. I've forked the repo and merged Poocarts branch to master here - https://github.com/Findiglay/cordova-imagePicker/branches

@Findiglay
Copy link

Nope, you want to just use: cordova plugin add
https://github.com/Findiglay/cordova-imagePicker.git

Grant Findlay
Developer

[image: It's time to decide! Click here to find out more!]
https://decidz.com/

Web: www.decidz.com
Call: +44 (0)7512378624 <+447512378624>

On 4 April 2016 at 11:40, Krishan notifications@github.com wrote:

@Findiglay https://github.com/Findiglay If I say like below will it
download Findiglay/cordova-imagePicker right.

cordova plugin add cordova-plugin-image-picker


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#126 (comment)

@salilmalik
Copy link

Hi @Findiglay

I removed the imagePicker plugin and used cordova plugin add https://github.com/Findiglay/cordova-imagePicker.git and when I use the ionic build android command it generates the androidManifest.xml file

In the androidManifest.xml I see instead of READ_EXTERNAL_STORAGE so I added
manually and used ionic run android but still the app is crashing.

Also I am getting the following error : C:\App\platforms\android\src\com\synconset\MultiImageChooserActivity.java uses unchecked or unsafe operations.

This is my AndroidManifest.xml

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.ionicframework.myapp132107" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:label="@string/multi_app_name" android:name="com.synconset.MultiImageChooserActivity" android:theme="@android:style/Theme.Holo.Light" />
    </application>
    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>

@danielgolub
Copy link

Anyone been able to solve it?
I still get crash if user haven't approved access to Photos first.

@richardmarais
Copy link

@danielgolub, I have the same issue. Have you found a solution yet?

@imarem
Copy link

imarem commented Aug 22, 2016

use a fork by @Findiglay cordova plugin add https://github.com/Findiglay/cordova-imagePicker.git, works fine!

@amostech
Copy link

@Findiglay thank you for forking and including a solution to this issue. I am using your forked version because it includes the READ_EXTERNAL_STORAGE permissions that I need for Android. But I think that this should be merged in the main stream of the plugin ASAP. Lots of people should be getting the same error in Android 6+

@arthur-cheung
Copy link

arthur-cheung commented Mar 22, 2017

@Findiglay, your version appears to work for Android, and newer iOS devices. But on older ones it crashes. All were on OS versions were 10.2.1, just different hardware. iPhone 7 was fine, but iPhone 6 and iPad 2 was not.

Investigating now to see if I can find out further what's going on.

EDIT: It looks like this forked fix has opposite effect on iOS. It wasn't so much newer iOS device that was okay, but it was a device that had permissions set already. This forked plugin was in fact crashing on iOS when it required permissions. So what it fixed for Android, appears to be crashing for iOS.

@usmanmirza
Copy link

usmanmirza commented Mar 13, 2018

Hi @Findiglay while adding the plugin I'm getting this error.

`(node:7376) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: Failed to fetch plugin https://github.com/Findiglay/cordova-imagePicker.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 1 Error output:
npm ERR! code ENOGIT
npm ERR! No git binary found in $PATH
npm ERR!
npm ERR! Failed using git.
npm ERR! Please check if you have git installed and in your PATH.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\usman\AppData\Roaming\npm-cache_logs\2018-03-13T08_34_15_168Z-debug.log
(node:7376) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.`

@gifthlong
Copy link

since https://github.com/Findiglay/cordova-imagePicker.git has been removed from github. Anyone knows of an alternative?

@basurahan
Copy link

the forked link is broken pls fix i need it asap thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests