Using Crop intent Getting java.lang.SecurityException: Unable to find app for caller android.app.ApplicationThreadProxy@4266ae80

匿名 (未验证) 提交于 2019-12-03 02:06:01

问题:

I am using crop intent to crop the image,most of time it run fine,but sometime getting java.lang.SecurityException: Unable to find app for caller android.app.ApplicationThreadProxy@4266ae80

I attached logcat ,

08-07 11:33:21.190: I/BugSenseHandler(3337): Registering default exceptions handler 08-07 11:33:21.230: I/BugSenseHandler(3337): Flushing... 08-07 11:33:21.230: I/BugSenseHandler(3337): Registering default exceptions handler 08-07 11:33:25.104: D/AndroidRuntime(3629): Shutting down VM 08-07 11:33:25.104: W/dalvikvm(3629): threadid=1: thread exiting with uncaught exception (group=0x41535700) 08-07 11:33:25.114: E/AndroidRuntime(3629): FATAL EXCEPTION: main 08-07 11:33:25.114: E/AndroidRuntime(3629): java.lang.SecurityException: Unable to find app for caller android.app.ApplicationThreadProxy@4266ae80 (pid=3629) when publishing content providers 08-07 11:33:25.114: E/AndroidRuntime(3629):     at android.os.Parcel.readException(Parcel.java:1431) 08-07 11:33:25.114: E/AndroidRuntime(3629):     at android.os.Parcel.readException(Parcel.java:1385) 08-07 11:33:25.114: E/AndroidRuntime(3629):     at android.app.ActivityManagerProxy.publishContentProviders(ActivityManagerNative.java:2649) 08-07 11:33:25.114: E/AndroidRuntime(3629):     at android.app.ActivityThread.installContentProviders(ActivityThread.java:4494) 08-07 11:33:25.114: E/AndroidRuntime(3629):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4425) 08-07 11:33:25.114: E/AndroidRuntime(3629):     at android.app.ActivityThread.access$1300(ActivityThread.java:141) 08-07 11:33:25.114: E/AndroidRuntime(3629):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316) 08-07 11:33:25.114: E/AndroidRuntime(3629):     at android.os.Handler.dispatchMessage(Handler.java:99) 08-07 11:33:25.114: E/AndroidRuntime(3629):     at android.os.Looper.loop(Looper.java:137) 08-07 11:33:25.114: E/AndroidRuntime(3629):     at android.app.ActivityThread.main(ActivityThread.java:5103) 08-07 11:33:25.114: E/AndroidRuntime(3629):     at java.lang.reflect.Method.invokeNative(Native Method) 08-07 11:33:25.114: E/AndroidRuntime(3629):     at java.lang.reflect.Method.invoke(Method.java:525) 08-07 11:33:25.114: E/AndroidRuntime(3629):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 08-07 11:33:25.114: E/AndroidRuntime(3629):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 08-07 11:33:25.114: E/AndroidRuntime(3629):     at dalvik.system.NativeStart.main(Native Method) 08-07 11:33:25.144: D/AndroidRuntime(3642): Shutting down VM 08-07 11:33:25.144: W/dalvikvm(3642): threadid=1: thread exiting with uncaught exception (group=0x41535700) 08-07 11:33:25.144: E/AndroidRuntime(3642): FATAL EXCEPTION: main 08-07 11:33:25.144: E/AndroidRuntime(3642): java.lang.SecurityException: Unable to find app for caller android.app.ApplicationThreadProxy@42508d78 (pid=3642) when publishing content providers 08-07 11:33:25.144: E/AndroidRuntime(3642):     at android.os.Parcel.readException(Parcel.java:1431) 08-07 11:33:25.144: E/AndroidRuntime(3642):     at android.os.Parcel.readException(Parcel.java:1385) 08-07 11:33:25.144: E/AndroidRuntime(3642):     at android.app.ActivityManagerProxy.publishContentProviders(ActivityManagerNative.java:2649) 08-07 11:33:25.144: E/AndroidRuntime(3642):     at android.app.ActivityThread.installContentProviders(ActivityThread.java:4494) 08-07 11:33:25.144: E/AndroidRuntime(3642):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4425) 08-07 11:33:25.144: E/AndroidRuntime(3642):     at android.app.ActivityThread.access$1300(ActivityThread.java:141) 08-07 11:33:25.144: E/AndroidRuntime(3642):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316) 08-07 11:33:25.144: E/AndroidRuntime(3642):     at android.os.Handler.dispatchMessage(Handler.java:99) 08-07 11:33:25.144: E/AndroidRuntime(3642):     at android.os.Looper.loop(Looper.java:137) 08-07 11:33:25.144: E/AndroidRuntime(3642):     at android.app.ActivityThread.main(ActivityThread.java:5103) 08-07 11:33:25.144: E/AndroidRuntime(3642):     at java.lang.reflect.Method.invokeNative(Native Method) 08-07 11:33:25.144: E/AndroidRuntime(3642):     at java.lang.reflect.Method.invoke(Method.java:525) 08-07 11:33:25.144: E/AndroidRuntime(3642):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 08-07 11:33:25.144: E/AndroidRuntime(3642):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 08-07 11:33:25.144: E/AndroidRuntime(3642):     at dalvik.system.NativeStart.main(Native Method) 08-07 11:33:25.184: W/Ads(3660): No Google Analytics: Library Incompatible. 08-07 11:33:25.244: D/dalvikvm(3660): GC_FOR_ALLOC freed 175K, 3% free 9014K/9216K, paused 16ms, total 16ms 08-07 11:33:25.244: I/dalvikvm-heap(3660): Grow heap (frag case) to 12.340MB for 3686416-byte allocation 08-07 11:33:25.254: D/dalvikvm(3660): GC_FOR_ALLOC freed : EGL 1.4 QUALCOMM Build: Iabe52cfaeae4c5fab1acacfe6f056ba15fa93274 08-07 11:33:25.635: I/Ads(3660): adRequestUrlHtml:  08-07 11:33:25.665: D/OpenGLRenderer(3660): Enabling debug mode 0 08-07 11:33:26.085: I/Ads(3660): Received ad url:  08-07 11:33:26.105: I/Ads(3660): Ad url modified to http://googleads.g.doubleclick.net:80/mads/gma?kw&preqs=0&session_id=6613293177245819931&u_sd=2&seq_num=1&u_w=384&msid=com.app.bbq&js=afma-sdk-a-v6.4.1&ms=NTjh9Cwud64HgDL2o-CmkGYsbLqDs9is_xUOeGgUumJiL5rzIMo1PShh4L2A1hSFxgRGKhRw30DlrAsqrfHR7nBPMt0A8u-JoC-ssjqL6kdra-xezf6QxJCoxTOPWpjPF9TLhaF7KbAWiSxt9-eq-3ud3XffCiSfoL-BHnFQoYDzEqAvy5ydxDRFcKhasAAsYS4Wm4qEJQnBpEsDUq1Uc9PZhzfAAIRzrBXdc9xE-W7GBgJ6YCccYNnlqRu-bjIj2uwPQsHrs6e7D_WZmOgTf4ujDTUPFdCnT8a3d0kUH7DmDP3CJ-Xk6H6eEXQ_RYsx427_JAtQypAXnCwYtCkekQ&mv=80220003.com.android.vending&bas_off=0&format=320x50_mb&oar=0&net=wi&app_name=1.android.com.app.bbq&hl=en&gnt=0&u_h=592&bas_on=0&ptime=0&u_audio=3&u_so=p&imbf=9&output=html&region=mobile_app&u_tz=330&client_sdk=1&ex=1&slotname=a151f0f89327fd9&kw_type=broad&gsb=wi&caps=inlineVideo_interactiveVideo_mraid1_th_mediation_sdkAdmobApiForAds_di&eisu=xyFCSEpNJCce6O6eZQAM3JSBgQHhdly4clD4DEIyhfqgmUQG7xp7UiVUQuVcj9KW6c9lVlIt38A6HN5CNLGKXEVzdCwE6d4b--X9fAjhhQnCaHrGFS0q8e_NXQz8Tvxi&et=11&jsv=53 08-07 11:33:26.105: I/Ads(3660): Request scenario: Online server request. 08-07 11:33:26.525: D/dalvikvm(3660): GC_FOR_ALLOC freed 956K, 7% free 14204K/15184K, paused 26ms, total 26ms 08-07 11:33:26.525: D/webviewglue(3660): nativeDestroy view: 0x73ad2728 08-07 11:33:26.536: W/CursorWrapperInner(3660): Cursor finalized without prior close() 08-07 11:33:27.006: E/award Added(3660): award/8 08-07 11:33:27.016: E/award Added(3660): award/9 08-07 11:33:27.026: E/award Added(3660): award/10 08-07 11:33:27.036: E/award Added(3660): award/11 08-07 11:33:27.046: E/award Added(3660): award/12 08-07 11:33:27.056: E/award Added(3660): award/13 08-07 11:33:27.066: E/award Added(3660): award/14 08-07 11:33:27.757: D/webviewglue(3660): nativeDestroy view: 0x73ad27b0 08-07 11:33:27.757: I/Ads(3660): onReceiveAd() 08-07 11:33:27.797: D/TilesManager(3660): Starting TG #0, 0x766f0880 08-07 11:33:27.797: D/TilesManager(3660): new EGLContext from framework: 75ef3328  08-07 11:33:27.797: D/GLWebViewState(3660): Reinit shader 08-07 11:33:27.837: D/GLWebViewState(3660): Reinit transferQueue 08-07 11:33:30.269: I/GAV2(3660): Thread[GAThread,5,main]: No campaign data found. 08-07 11:35:38.957: I/BugSenseHandler(3660): Registering default exceptions handler 08-07 11:35:38.987: I/BugSenseHandler(3660): Flushing... 08-07 11:35:38.987: I/BugSenseHandler(3660): Registering default exceptions handler 08-07 11:35:39.978: D/dalvikvm(3660): GC_FOR_ALLOC freed 1427K, 10% free 14561K/16012K, paused 29ms, total 29ms

回答1:

This log means that your app is having trouble handling a communication intent. Sometimes problems like this can occur when you send intent with very big extras.

Passing High resolution photos or big file via extras is not recommended, the best practice is to save the file on the external storage (if you haven't done it yet), get a Uri reference to it and send this ref as String in your intent's extra

yourIntent.putExtra("MyUriKey", yourUri.toString)

If you are dealing with an image and quality is not of your concern, you can use a workaround and simply reduce the file's dimension by compressing it.



回答2:

In my case, i was passing a byteArray of a bitmap in a intent. After seeing Roberto Lombardini's answer, I changed my code so that it could send the uri of the bitmap instead, and my problem was gone.



回答3:

I agree with the Roberto Lombardini's answer. Maybe you can try this solution for simple reference.

  1. Save your bitmap into local first with unique name or you own resource id, you can use UUID

    public void savePhotoCache(final String resourceId, final Bitmap bitmap) {     if(bitmap==null)         return;      File imageDir = new File(context.getCacheDir(), "images/yourpackagename");     if (!imageDir.isDirectory())         imageDir.mkdirs();      File cachedImage = new File(imageDir, resourceId);     FileOutputStream output = null;     try {         output = new FileOutputStream(cachedImage);         bitmap.compress(PNG, 100, output);     } catch (IOException e) {         Log.d("CACHED_IMAGE", "Exception writing cache image", e);             
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!