startActivity(new Intent(this, SettingsActivity.class));
在 4.0 上为我的一位用户提供了此错误的实例:
java.lang.SecurityException: Not allowed to start activity Intent { cmp=co.bandicoot.ztrader/.activity.SettingsActivity }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1675)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1442)
at android.app.Activity.startActivityForResult(Activity.java:3474)
at android.app.Activity.startActivityForResult(Activity.java:3435)
at android.support.v4.app.FragmentActivity.startActivityForResult(SourceFile:839)
at android.app.Activity.startActivity(Activity.java:3677)
at android.app.Activity.startActivity(Activity.java:3645)
at co.bandicoot.ztrader.activity.MainActivity.onOptionsItemSelected(SourceFile:3446)
.....
这是我的 SettingsActivity 清单声明:
<activity
android:name="co.bandicoot.ztrader.activity.SettingsActivity"
android:label="@string/action_settings"
android:parentActivityName="co.bandicoot.ztrader.activity.MainActivity"
android:screenOrientation="portrait" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="co.bandicoot.ztrader.activity.MainActivity" />
</activity>
有任何想法吗?
编辑:这是我的完整清单。这里有什么问题吗?我正在查看 SettingsActivity ,似乎其中没有任何可能需要额外权限的东西。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="co.bandicoot.ztrader"
android:versionCode="110"
android:versionName="3.5.2" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="20" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:theme="@style/Theme.Ztraderdarkactionbar" >
<receiver android:name=".TickerAlarm" >
</receiver>
<receiver android:name=".FastAlarm" >
</receiver>
<receiver android:name=".DownloadCurrencyPairsTask" >
</receiver>
<receiver android:name=".AutoStart" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" >
</action>
</intent-filter>
</receiver>
<service android:name="KillNotificationService" >
</service>
<activity
android:name="co.bandicoot.ztrader.activity.MainActivity"
android:configChanges="orientation"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:uiOptions="splitActionBarWhenNarrow"
android:windowSoftInputMode="stateHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="co.bandicoot.ztrader.activity.CreateKeyActivity"
android:label="@string/create_key"
android:parentActivityName="co.bandicoot.ztrader.activity.MainActivity"
android:screenOrientation="portrait" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="co.bandicoot.ztrader.activity.MainActivity" />
</activity>
<activity
android:name="co.bandicoot.ztrader.activity.HistoryActivity"
android:label="@string/history"
android:parentActivityName="co.bandicoot.ztrader.activity.MainActivity"
android:screenOrientation="portrait" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="co.bandicoot.ztrader.activity.MainActivity" />
</activity>
<activity
android:name="co.bandicoot.ztrader.activity.SettingsActivity"
android:label="@string/action_settings"
android:parentActivityName="co.bandicoot.ztrader.activity.MainActivity"
android:screenOrientation="portrait" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="co.bandicoot.ztrader.activity.MainActivity" />
</activity>
<activity
android:name="co.bandicoot.ztrader.activity.ChartActivity"
android:label="@string/app_name"
android:parentActivityName="co.bandicoot.ztrader.activity.MainActivity"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="co.bandicoot.ztrader.activity.MainActivity" />
</activity>
<activity
android:name="co.bandicoot.ztrader.activity.ManagePairsActivity"
android:label="@string/pairs"
android:screenOrientation="portrait" >
</activity>
</application>
</manifest>