gpt4 book ai didi

Android 运行时错误(仅限真实设备): SecurityException

转载 作者:行者123 更新时间:2023-11-29 21:21:58 25 4
gpt4 key购买 nike

该应用程序在我的 Genymotion 模拟器上运行,但在真实设备上运行时失败,启动时出现此异常:

Launching application: <package>/<package>.MainActivity.
DEVICE SHELL COMMAND: am start -D -n "<package>/<package>.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=<package>/.MainActivity }
java.lang.SecurityException: Permission Denial: starting Intent { act=<package>.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=<package>/.MainActivity } from null (pid=21943, uid=2000) not exported from uid 10204
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.app.ActivityManagerProxy.startActivityAsUser(ActivityManagerNative.java:2204)
at com.android.commands.am.Am.runStart(Am.java:494)
at com.android.commands.am.Am.run(Am.java:109)
at com.android.commands.am.Am.main(Am.java:82)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243)
at dalvik.system.NativeStart.main(Native Method)

Waiting for process: <package>

这是我的 list :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="<package>"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="<package>.MainActivity"
android:label="@string/app_name" >
</activity>
</application>

</manifest>

和 MainActivity.java:

public class MainActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

}

这是怎么回事?当我只是使用正常配置时,为什么它会尝试以特定用户身份运行?

最佳答案

menifest.xml 文件中进行以下更改

<activity
android:name="<package>.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

关于Android 运行时错误(仅限真实设备): SecurityException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20626225/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com