androidAPP调用第三方APP(java.lang.SecurityException: Permission Denial: starting Intent { flg=0x16c70 cm)

在写APP调用时出现的的一个问题,简单记录

1、当前调用的app中代码为:

Intent  paramAdapterView = new Intent();
                paramAdapterView.setComponent(new ComponentName("com.gsoft.cddcdjianxiu", "com.gsoft.cddcdjianxiu.motorjobprocesscontrol_Activty.JobProcessControl_Activty"));//tiao
                paramAdapterView.setFlags(93296);//设置标记
                Log.d("wyb", "Util.toJson(rwmtUserData)=" + lz);
                paramAdapterView.putExtra("data", lz);
                startActivity(paramAdapterView);
2、执行后出现以下错误:
 FATAL EXCEPTION: main
                                                                               java.lang.SecurityException: Permission Denial: starting Intent { flg=0x16c70 cmp=com.gsoft.cddcdjianxiu/.motorjobprocesscontrol_Activty.JobProcessControl_Activty (has extras) } from ProcessRecord{42234430 27493:test.softer.com.myapplication/u0a10076} (pid=27493, uid=10076) not exported from uid 10071
                                                                                   at android.os.Parcel.readException(Parcel.java:1431)
                                                                                   at android.os.Parcel.readException(Parcel.java:1385)
                                                                                   at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1947)
                                                                                   at android.app.Instrumentation.execStartActivity(Instrumentation.java:1419)
                                                                                   at android.app.Activity.startActivityForResult(Activity.java:3390)
                                                                                   at android.app.Activity.startActivityForResult(Activity.java:3351)
                                                                                   at android.app.Activity.startActivity(Activity.java:3587)
                                                                                   at android.app.Activity.startActivity(Activity.java:3555)
根据出现的错误找到原因:在被调用的 JobProcessControl_Activty在Android manifest中添加
android:exported="true"

这样就解决了这个问题

如果还是没有得到解决看看添加一下代码

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
intent-filter>



你可能感兴趣的:(Android)