标签: remoteexception

Android RemoteExceptions和服务

所以我为Android操作系统编写了一个服务和一个活动.

我的服务在它自己的进程中运行,因此我的活动和服务之间的所有通信都是通过IPC进行的.我使用标准的Android .aidl机制.

到目前为止一切正常.但是,AIDL使用"throws RemoteException"生成所有方法存根,因此我必须处理它们.

我对整个Android源代码做了快速的grep,并且只发现了三个抛出此异常的情况.这些是我不联系的不同服务.

我也检查了C源代码,因为理论上可以使用JNI接口生成RemoteExceptions.没有出现任何问题.

我的印象是每个人都像这样处理它们:

  try {

    mService.someMethodCall (someArguments);

  } catch (RemoteException e) {

    e.printStackTrace();

  }
Run Code Online (Sandbox Code Playgroud)

这不是可靠的代码,我不想在我的代码库中使用这样的东西.

除此之外:我试图通过IPC自己抛出一个RemoteException,我得到的只是一个堆栈跟踪和系统日志消息,它告诉我还不支持异常.我的应用程序从未看到异常,抛出异常的服务最终处于一个非常奇怪的状态(半途工作):-(

问题是:

  • 是否会抛出这些异常?

  • 有没有人见过这样的try-catch块捕获RemoteException?

  • 难道它们不存在而且我们只是被迫处理它们,因为"抛出RemoteException"是死代码还是AIDL编译器内部的遗留问题?

免责声明:我还没有阅读完整的源代码.我使用Grep来查找RemoteException的出现,所以我可能因为不同的空格使用而错过了一些.

service android aidl remoteexception

26
推荐指数
2
解决办法
2万
查看次数

Android 7.0 或以上版本创建异常 android.app.RemoteServiceException:

当我们上传我的应用程序的更新时,Android 7.0 或更高版本创建异常将导致崩溃

android.app.RemoteServiceException: at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1681) at android.os.Handler.dispatchMessage (Handler.java:102) at android.os.Looper.loop (Looper.java) :241) at android.app.ActivityThread.main (ActivityThread.java:6274) at java.lang.reflect.Method.invoke (Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit. java:886) 在 com.android.internal.os.ZygoteInit.main (ZygoteInit.java:776)

Google Play Developer Console 报告此崩溃

remoteexception android-7.0-nougat android-studio-3.0

7
推荐指数
0
解决办法
1061
查看次数

应用程序自动退出,没有任何警告或错误

我使用tesseract Library开发了OCR应用程序,

应用程序在执行以下代码时退出:

/*...
... Other Code stuff
...*/
    protected Boolean doInBackground(String... arg0) {

    /*...
    ... Other Code stuff
    ...*/
    Pix pix = getPixFromBitmap(bitmap);
    pix = preprocess(pix);
    Pixa pixa = slice(pix); // Code Updated

    try {
        baseApi.setPageSegMode(TessBaseAPI.PSM_SINGLE_LINE);

        int num = pixa.size();

        for (int i = 0; i < num; i++) {
            Pix pixi = pixa.getPix(i);

            /*...
            ... Other Code stuff
            ...*/
        }
        pixa.recycle();
        baseApi.end();

    } catch (RuntimeException e) {
Log.e("OcrRecognizeAsyncTask","Caught RuntimeException in request to Tesseract. Setting state to CONTINUOUS_STOPPED.");
        e.printStackTrace(); …
Run Code Online (Sandbox Code Playgroud)

android crash-reports android-ndk remoteexception android-logcat

5
推荐指数
1
解决办法
2227
查看次数

Powershell中的Python脚本:远程异常和NativeCommandError

我正在学习用Python编写代码(并且第一次使用Powershell),所以我认为我的问题非常基础.当我尝试在PS中运行任何Python脚本时,我收到类似下面的错误.我在网上找到的主要建议是(1)确保我将执行策略设置为不受限制,以及(2)编辑我的路径以包括"c:\Python27;c:\Python27\Scripts"我已完成这两件事.我还应该尝试什么?

   PS C:\windows\system32> python
python.exe : Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
At line:1 char:7
+ python <<<< 
    + CategoryInfo          : NotSpecified: (Python 2.7.6 (d...ntel)] on win32:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError


Type "help", "copyright", "credits" or "license" for more information.
Run Code Online (Sandbox Code Playgroud)

python powershell remoteexception

5
推荐指数
1
解决办法
3207
查看次数