无法启动艾滋病服务:java.lang.securityexception:不允许启动服务意图




当我尝试从ClientApp启动AIDL应用程序服务时,获得以下错误:

FATAL EXCEPTION: main
        Process: rajusugale.dev.clientmodule, PID: 5873
        java.lang.RuntimeException: Unable to start activity ComponentInfo{rajusugale.dev.clientmodule/rajusugale.dev.clientmodule.MainActivity}: java.lang.SecurityException: Not allowed to start service Intent { cmp=rajusugale.dev.myaidllibrary/.CoffeeMakerRemoteService } without permission not exported from uid 10096
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
        at android.app.ActivityThread.-wrap12(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6119)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

代码:

Intent serviceIntent = new Intent()
                            .setComponent(new ComponentName(
                                    "rajusugale.dev.myaidllibrary", "rajusugale.dev.myaidllibrary.CoffeeMakerRemoteService"));
    mLog.setText("Starting service…n");
    startService(serviceIntent);
    mLog.append("Binding service…n");
    bindService(serviceIntent, mConnection, BIND_AUTO_CREATE);


github上的来源:
https://github.com/rajuse/aidl-remote-service


首先,我正在打开AIDL应用程序(可以运行服务的过程(,然后运行端端,该应用程序试图远程运行此服务。
请让我知道我是否缺少什么?

基于错误,我认为您忘记了在客户端应用的服务标签中添加android:exported="true"

我希望这会有所帮助。

最新更新