Logcat 错误描述:按钮启动使应用程序崩溃

Posted

技术标签:

【中文标题】Logcat 错误描述:按钮启动使应用程序崩溃【英文标题】:Logcat error description : Button launch crashes app 【发布时间】:2013-09-17 17:25:56 【问题描述】:

清单文件中有一些权限限制......我删除了它,但应用程序仍然在按钮单击时崩溃......其余按钮工作正常......当我使用记事本时它开始发生SDK 中的示例代码为我的应用程序实现类似的“保存注释”

这些是新的 logcat 详细信息


   09-13 03:23:42.743: E/AudioTrack(776): Could not get audio output for stream type 3
09-13 03:23:42.743: E/SoundPool(776): Error creating AudioTrack
09-13 03:23:43.363: D/dalvikvm(776): GC_FOR_ALLOC freed 104K, 3% free 10299K/10524K, paused 61ms, total 95ms
09-13 03:23:43.394: I/dalvikvm-heap(776): Grow heap (frag case) to 13.121MB for 3094560-byte allocation
09-13 03:23:43.563: D/dalvikvm(776): GC_FOR_ALLOC freed 3542K, 28% free 9779K/13548K, paused 172ms, total 173ms
09-13 03:23:44.223: I/Choreographer(776): Skipped 329 frames!  The application may be doing too much work on its main thread.
09-13 03:23:44.493: I/Choreographer(776): Skipped 64 frames!  The application may be doing too much work on its main thread.
09-13 03:23:44.913: I/Choreographer(776): Skipped 97 frames!  The application may be doing too much work on its main thread.
09-13 03:23:45.693: I/Choreographer(776): Skipped 77 frames!  The application may be doing too much work on its main thread.
09-13 03:23:51.364: E/AudioTrack(776): Could not get audio output for stream type 3
09-13 03:23:51.364: E/SoundPool(776): Error creating AudioTrack
09-13 03:23:51.914: D/androidRuntime(776): Shutting down VM
09-13 03:23:51.914: W/dalvikvm(776): threadid=1: thread exiting with uncaught exception (group=0x41465700)
09-13 03:23:52.024: E/AndroidRuntime(776): FATAL EXCEPTION: main
09-13 03:23:52.024: E/AndroidRuntime(776): java.lang.RuntimeException: Unable to start activity ComponentInfohellog.diwesh.NugaBest/helog.diwesh.NugaBest.NotesList: java.lang.SecurityException: Permission Denial: opening provider com.example.android.notepad.NotePadProvider from ProcessRecord41986ad8 776:hellog.diwesh.NugaBest/u0a10049 (pid=776, uid=10049) that is not exported from uid 10050
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.os.Handler.dispatchMessage(Handler.java:99)
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.os.Looper.loop(Looper.java:137)
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.app.ActivityThread.main(ActivityThread.java:5103)
09-13 03:23:52.024: E/AndroidRuntime(776):  at java.lang.reflect.Method.invokeNative(Native Method)
09-13 03:23:52.024: E/AndroidRuntime(776):  at java.lang.reflect.Method.invoke(Method.java:525)
09-13 03:23:52.024: E/AndroidRuntime(776):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-13 03:23:52.024: E/AndroidRuntime(776):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-13 03:23:52.024: E/AndroidRuntime(776):  at dalvik.system.NativeStart.main(Native Method)
09-13 03:23:52.024: E/AndroidRuntime(776): Caused by: java.lang.SecurityException: Permission Denial: opening provider com.example.android.notepad.NotePadProvider from ProcessRecord41986ad8 776:hellog.diwesh.NugaBest/u0a10049 (pid=776, uid=10049) that is not exported from uid 10050
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.os.Parcel.readException(Parcel.java:1431)
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.os.Parcel.readException(Parcel.java:1385)
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:2611)
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.app.ActivityThread.acquireProvider(ActivityThread.java:4515)
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2036)
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1149)
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.content.ContentResolver.query(ContentResolver.java:398)
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.content.ContentResolver.query(ContentResolver.java:357)
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.app.Activity.managedQuery(Activity.java:1765)
09-13 03:23:52.024: E/AndroidRuntime(776):  at helog.diwesh.NugaBest.NotesList.onCreate(NotesList.java:104)
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.app.Activity.performCreate(Activity.java:5133)
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
09-13 03:23:52.024: E/AndroidRuntime(776):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
09-13 03:23:52.024: E/AndroidRuntime(776):  ... 11 more
09-13 03:23:56.654: I/Process(776): Sending signal. PID: 776 SIG: 9

Androidmanifst

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

    <uses-sdk android:minSdkVersion="11" />

    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:name="helog.diwesh.NugaBest.MyApplication" 
        android:debuggable="true"
        android:icon="@drawable/nuga"
        android:label="@string/app_name" >
        <activity
            android:name="helog.diwesh.NugaBest.NUGA_HealthCareActivity_Intro"
            android:configChanges="orientation|keyboardHidden"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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








        // 4. Layout Management

        <activity
            android:name="helog.diwesh.NugaBest.FileSiganlDisplay"
            android:label="FileSiganlDisplay" />
        <activity
            android:name="helog.diwesh.NugaBest.NUGA_WebJoinActivity"
            android:label="NUGA_WebJoinActivity"
            android:windowSoftInputMode="stateHidden" />
        <activity
            android:name="helog.diwesh.NugaBest.NUGA_MainMenuActivity"
            android:label="NUGA_MainMenuActivity" />
        <activity
            android:name="helog.diwesh.NugaBest.BTSmartSlavemodule"
            android:configChanges="orientation|keyboardHidden"
            android:label="SmartSlavemodule" />
        <activity
            android:name="helog.diwesh.NugaBest.BTDeviceListActivity"
            android:configChanges="orientation|keyboardHidden"
            android:label="@string/select_device"
            android:theme="@android:style/Theme.Dialog" />

        <activity
            android:name="helog.diwesh.NugaBest.SnapActivity"
            android:label="@string/title_activity_snap" >
        </activity>
        <activity
            android:name="helog.diwesh.NugaBest.ImagesActivity"
            android:label="@string/title_activity_images" >
        </activity>
        <activity
            android:name="helog.diwesh.NugaBest.HelpActivity"
            android:label="@string/Help" >
        </activity>
        <activity
            android:name="helog.diwesh.NugaBest.AboutDevice"
            android:label="@string/aboutus" >
        </activity>




        // Notepad Application




         <activity android:name="NotesList" android:label="@string/title_notes_list">

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <action android:name="android.intent.action.EDIT" />
                <action android:name="android.intent.action.PICK" />

                <data android:mimeType="vnd.android.cursor.dir/vnd.google.note" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.GET_CONTENT" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/vnd.google.note" />
            </intent-filter>
        </activity>

        <activity android:name="NoteEditor"
            android:theme="@android:style/Theme.Holo.Light"
            android:screenOrientation="sensor"
            android:configChanges="keyboardHidden|orientation"
        >
            <!-- This filter says that we can view or edit the data of
                 a single note -->
            <intent-filter android:label="@string/resolve_edit">
                <action android:name="android.intent.action.VIEW" />
                <action android:name="android.intent.action.EDIT" />
                <action android:name="helog.diwesh.NugaBest.action.EDIT_NOTE" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.item/vnd.google.note" />
            </intent-filter>

            <!-- This filter says that we can create a new note inside
                 of a directory of notes.  The INSERT action creates an
                 empty note; the PASTE action initializes a new note from
                 the current contents of the clipboard. -->
            <intent-filter>
                <action android:name="android.intent.action.INSERT" />
                <action android:name="android.intent.action.PASTE" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="vnd.android.cursor.dir/vnd.google.note" />
            </intent-filter>

        </activity>

        <activity android:name="TitleEditor"
            android:label="@string/title_edit_title"
            android:icon="@drawable/ic_menu_edit"
            android:theme="@android:style/Theme.Holo.Dialog"
            android:windowSoftInputMode="stateVisible">
            <!-- This activity implements an alternative action that can be
                 performed on notes: editing their title.  It can be used as
                 a default operation if the user invokes this action, and is
                 available as an alternative action for any note data. -->
            <intent-filter android:label="@string/resolve_title">
                <!-- This is the action we perform.  It is a custom action we
                     define for our application, not a generic VIEW or EDIT
                     action since we are not a general note viewer/editor. -->
                <action android:name="helog.diwesh.NugaBest.action.EDIT_TITLE" />
                <!-- DEFAULT: execute if being directly invoked. -->
                <category android:name="android.intent.category.DEFAULT" />
                <!-- ALTERNATIVE: show as an alternative action when the user is
                     working with this type of data. -->
                <category android:name="android.intent.category.ALTERNATIVE" />
                <!-- SELECTED_ALTERNATIVE: show as an alternative action the user
                     can perform when selecting this type of data. -->
                <category android:name="android.intent.category.SELECTED_ALTERNATIVE" />
                <!-- This is the data type we operate on. -->
                <data android:mimeType="vnd.android.cursor.item/vnd.google.note" />
            </intent-filter>
        </activity>

        <activity android:name="NotesLiveFolder" android:label="@string/live_folder_name"
            android:icon="@drawable/live_folder_notes">
            <intent-filter>
                <action android:name="android.intent.action.CREATE_LIVE_FOLDER" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>







    </application>

</manifest>

【问题讨论】:

请贴出相关代码 您在清单文件中删除的内容。 E/AndroidRuntime(786): android.content.ActivityNotFoundException: Unable to find explicit activity class hellog.diwesh.NugaBest/helog.diwesh.NugaBest.NotesList; have you declared this activity in your AndroidManifest.xml? @Raghunandan:伙计,我已经发布了上一个问题中的所有代码。必须将两者分开,因为他的网站不允许我包含更多字符 @AnshSharma 您的包名称是 hellog.diwesh.NugaBest 但您在所有活动中声明,例如 helog.diwesh.NugaBest 您错过了 l . 【参考方案1】:

您尚未在清单文件中声明 NoteList 活动。

请将此包含在您的清单中。

希望对你有帮助!!

【讨论】:

【参考方案2】:
Unable to find explicit activity class hellog.diwesh.NugaBest/helog.diwesh.NugaBest.NotesList; have you declared this activity in your AndroidManifest.xml?

这意味着您忘记在清单文件中声明您的NotesList activity,如果您声明了您的packagename在声明中会有问题,请在您的清单文件中交叉检查activity &amp; package name并确认您声明正确.

【讨论】:

【参考方案3】:

这里出错,你没有正确声明

<activity android:name="NotesList" android:label="@string/title_notes_list">

变成这样

<activity android:name=".NotesList" android:label="@string/title_notes_list">

你的包名错误你的包名是hellog.diwesh.NugaBest,但你在所有活动中声明,如helog.diwesh.NugaBest,据此更改。

【讨论】:

不要认为这是问题 检查一下,这是这里的问题。活动应该有包。 请检查此developer.android.com/guide/components/intents-filters.html。示例具有 package="com.example.android.notepad"&gt; 和活动条目为 activity android:name="NotesList" android:label="@string/title_notes_list"&gt; @all 我做了更改,这就是新日志的样子

以上是关于Logcat 错误描述:按钮启动使应用程序崩溃的主要内容,如果未能解决你的问题,请参考以下文章

闪屏崩溃(Logcat 错误)

Listview 启动后崩溃

由于文本输入错误,应用程序不断崩溃[重复]

Android - 应用程序启动时片段 onCreate 崩溃

发布 apk 安装但启动时崩溃。该应用程序在调试模式下完美运行。我查看了 Android Studio,这是我的 adb logcat。

按钮操作使应用程序崩溃[重复]