簡體   English   中英

java.lang.SecurityException:權限被拒絕:啟動 Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]

[英]java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]

啟動activity時出錯,不幸的是,由於應用程序在genymotion模擬器上啟動,而不是在物理設備上啟動,因此我認為它與項目沒有嚴格連接。

當我在連接真實設備的情況下運行adb devices時,我得到:

List of devices attached 
0009215b1eef4f  device

AndroidManifest.xml沒有任何權限設置和設備有足夠api version

問候

只需添加:

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

AndroidManifest.xml上進入標簽:

<activity>

希望能幫助到你

問題在於Android Studio中的Launcher選擇。 為了提高應用程序模塊的測試速度,選擇了其他Activity作為Launcher (在運行屬性中),而不是在manifest.xml中指定的。 很奇怪它甚至在模擬器上工作..

解決方案只是將Launcher更改為AndroidManifest.xml的一個

正如@Tushar Gogna 在評論中所說。

“如果您在清單中添加了 android:exported="false",也會發生這種情況”

添加這個作為答案,因為它對我有用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM