13

我正在使用裁剪意图来裁剪图像,大多数情况下它运行良好,但有时会出现 java.lang.SecurityException: Unable to find app for caller android.app.ApplicationThreadProxy@4266ae80

我附上了 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 <1K, 2% free 12614K/12820K, paused 13ms, total 13ms
08-07 11:33:25.384: D/dalvikvm(3660): GC_FOR_ALLOC freed 8K, 2% free 13584K/13780K, paused 11ms, total 11ms
08-07 11:33:25.514: I/Ads(3660): To get test ads on this device, call adRequest.addTestDevice("1D8E15EB640F879FCDCED4F201F62CAF");
08-07 11:33:25.524: V/GCMRegistrar(3660): Is registered on server: false
08-07 11:33:25.524: I/System.out(3660): registraion idAPA91bFQth1lFb5nVmxSWfeIkg3IDi9XsM3eJI9BvseFzE0ARi0QvZOTwSLu9b9muga5lttmg6eu9z4gbvfSo-1qQJLAqWbasGWm5s8RB8Yln4rGEXIs6VHcFzMyTbT0yrX1_jn0Lg-UWF74fXtlu0JGqTYOzZqDhg
08-07 11:33:25.534: I/BugSenseHandler(3660): Registering default exceptions handler
08-07 11:33:25.534: D/dalvikvm(3660): DexOpt: --- BEGIN 'ads1741195214.jar' (bootstrap=0) ---
08-07 11:33:25.574: I/BugSenseHandler(3660): Flushing...
08-07 11:33:25.584: I/BugSenseHandler(3660): Registering default exceptions handler
08-07 11:33:25.605: D/libEGL(3660): loaded /system/lib/egl/libEGL_adreno200.so
08-07 11:33:25.605: D/libEGL(3660): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
08-07 11:33:25.605: D/dalvikvm(3660): DexOpt: --- END 'ads1741195214.jar' (success) ---
08-07 11:33:25.605: D/dalvikvm(3660): DEX prep '/data/data/com.app.bbq/cache/ads1741195214.jar': unzip in 0ms, rewrite 69ms
08-07 11:33:25.605: D/libEGL(3660): loaded /system/lib/egl/libGLESv2_adreno200.so
08-07 11:33:25.615: I/Adreno200-EGL(3660): <qeglDrvAPI_eglInitialize:265>: EGL 1.4 QUALCOMM Build: Iabe52cfaeae4c5fab1acacfe6f056ba15fa93274
08-07 11:33:25.635: I/Ads(3660): adRequestUrlHtml: <html><head><script src="http://media.admob.com/sdk-core-v40.js"></script><script>AFMA_getSdkConstants();AFMA_buildAdURL({"kw":[],"preqs":0,"session_id":"6613293177245819931","u_sd":2,"seq_num":"1","slotname":"a151f0f89327fd9","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","isu":"1D8E15EB640F879FCDCED4F201F62CAF","bas_off":0,"format":"320x50_mb","oar":0,"net":"wi","app_name":"1.android.com.app.bbq","hl":"en","ad_pos":{"height":0,"visible":0,"y":0,"x":0,"width":0},"gnt":0,"u_h":592,"pt":1,"bas_on":0,"ptime":0,"u_audio":3});</script></head><body></body></html>
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: <url: "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=%40installed_markets%40&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" type: "admob" afmaNotifyDt: "null" activationOverlayUrl: "null" useWebViewLoadUrl: "false">
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
4

3 回答 3

22

此日志表示您的应用在处理通信意图时遇到问题。有时,当您发送带有非常大的附加内容的意图时,可能会出现此类问题。

不建议通过附加功能传递高分辨率照片或大文件,最佳做法是将文件保存在外部存储上(如果您还没有这样做),获取Uri对它的引用并将此引用作为字符串发送到您的意图中额外的

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

如果您正在处理图像并且质量不是您关心的问题,您可以使用一种解决方法并通过压缩它来简单地减小文件的尺寸。

于 2013-08-07T07:34:55.877 回答
2

就我而言,我在意图中传递了位图的 byteArray。看到 Roberto Lombardini 的回答后,我更改了代码,以便它可以发送位图的 uri,而我的问题就消失了。

于 2013-11-29T13:54:32.063 回答
0

我同意 Roberto Lombardini 的回答。也许您可以尝试此解决方案以供简单参考。

  1. 首先使用唯一名称或您自己的资源 ID 将位图保存到本地,您可以使用 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);
        } finally {
            if (output != null)
                try {
                    output.close();
                } catch (IOException e) {
                    // Ignored
                }
        }
    }
    
  2. 当传递给另一个活动时,您只需传递资源 id 并使用此函数在另一个活动中获取位图数据。

    private Bitmap getPhotoCache(final String resourceId) {
        File imageDir = new File(context.getCacheDir(), "images/yourpackagename");
        if (!imageDir.isDirectory())
            imageDir.mkdirs();
    
        File imageFile = new File(imageDir, resourceId);
    
        if (!imageFile.exists() || imageFile.length() == 0)
            return null;
    
        Bitmap bitmap = BitmapFactory.decodeFile(imageFile.getAbsolutePath());
        if (bitmap != null)
            return bitmap;
        else {
            imageFile.delete();
            return null;
        }
    }
    

我希望这可以帮助你。:)

于 2014-10-02T09:04:30.497 回答