错误解决: java.lang.SecurityException: Permission Denial

时间:2022-10-11 23:14:36

场景:

当我们在别的应用内调用你某个程序的Activity有时候会发生这个错误:

 java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.siveco.bluebee.phone.supervisor/com.siveco.bluebee.core.activity.GetServerAddressActivity } from ProcessRecord{412d7170 1644:com.siveco.bluebee.project.productionfeedback/10056} (pid=1644, uid=10056) not exported from uid 10047

此错误源自于以下代码。

 

  if (APPTools.checkAPP(this.getApplicationContext(), BBA_PACKAGENAME)) {
            Intent intent = new Intent();
            intent.setClassName(BBA_PACKAGENAME, "com.siveco.bluebee.core.activity.GetServerAddressActivity");
            startActivityForResult(intent, REQUEST_CODE);

      }</span>



解决方案:

在Activity中配置属性exported="true"

       

        <activity
            android:name="com.siveco.bluebee.core.activity.GetServerAddressActivity"
            android:label="@string/title_activity_get_server_address"
            android:exported="true" >
        </activity>