0

エラー行 21: 行 21 は: android:entryValues="@array/listValues" です。このエラーは Android < 3 でのみ発生します。何か考えはありますか? Logcat は、アプリを起動してエミュレータを回転させたときのことです。

プリファレンス.xml:

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
        <PreferenceCategory

                android:title="sett"
                android:summary="Sett">

            <CheckBoxPreference
                        android:title="Notify"
                        android:defaultValue="true"
                        android:summary="on off"
                        android:key="checkboxPref" />

        </PreferenceCategory>

        <PreferenceCategory
            android:title="Animation" >

        <ListPreference
         android:entries="@array/listOptions"
         android:entryValues="@array/listValues"
         android:key="listpref"
         android:summary="time"
         android:title="time" />

        </PreferenceCategory>

</PreferenceScreen>

arrayfade.xml:

<?xml version="1.0" encoding="utf-8"?>
     <resources xmlns:android="http://schemas.android.com/apk/res/android">
       <string-array name="listOptions">
         <item>Mezzo secondo</item>
         <item>Un secondo</item>
         <item>Un secondo e mezzo</item>
         <item>Due secondi</item>
         </string-array>

       <string-array name="listValues">
         <item>500</item>
         <item>1000</item>
         <item>1500</item>
         <item>2000</item>
       </string-array>
     </resources>

ログキャット:

I/ActivityManager(   52): Displayed activity com.example.app/.MainActivity: 2372 ms (total 2372 ms)
I/ActivityManager(   52): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=1/1 orien=2 layout=18}
I/UsageStats(   52): Unexpected resume of com.example.app while already resumed in com.example.app
W/SurfaceFlinger(   52): timeout expired mFreezeDisplay=1, mFreezeCount=0
I/WindowManager(   52): Setting rotation to 0, animFlags=0
I/ActivityManager(   52): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=1/1 orien=1 layout=18}
I/UsageStats(   52): Unexpected resume of com.example.app while already resumed in com.example.app
D/dalvikvm(  660): GC freed 3448 objects / 774776 bytes in 59ms
I/dalvikvm(  660): Stack overflow, expanding (0x41049200 to 0x41049000)
I/dalvikvm(  660): Shrank stack (to 0x41049200, curFrame is 0x41049488)
D/AndroidRuntime(  660): Shutting down VM
W/dalvikvm(  660): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
E/ACRA    (  660): ACRA caught a StackOverflowError exception for com.example.app. Building report.
I/NotificationService(   52): enqueueToast pkg=com.example.app callback=android.app.ITransientNotification$Stub$Proxy@43bf7008 duration=1
D/dalvikvm(  660): GC freed 6838 objects / 1236840 bytes in 65ms
D/dalvikvm(  660): GREF has increased to 201
D/dalvikvm(   52): GREF has increased to 501
D/dalvikvm(   52): GC freed 6591 objects / 308072 bytes in 96ms
D/dalvikvm(  660): GREF has increased to 301
D/dalvikvm(  660): GC freed 10418 objects / 650872 bytes in 78ms
D/dalvikvm(   52): GC freed 2244 objects / 129800 bytes in 103ms
D/dalvikvm(  660): GC freed 3169 objects / 152248 bytes in 75ms
I/ACRA    (  660): READ_LOGS granted! ACRA can include LogCat and DropBox data.
D/ACRA    (  660): Retrieving logcat output...
D/ACRA    (  660): Writing crash report file 1356895743000.stacktrace.
D/dalvikvm(  660): GC freed 8682 objects / 1094864 bytes in 72ms
D/ACRA    (  660): About to start ReportSenderWorker from #handleException
D/ACRA    (  660): Mark all pending reports as approved.
D/ACRA    (  660): Looking for error files in /data/data/com.example.app/files
D/ACRA    (  660): #checkAndSendReports - start
D/ACRA    (  660): Looking for error files in /data/data/com.example.app/files
I/ACRA    (  660): Sending file 1356895743000-approved.stacktrace
D/dalvikvm(  660): DestroyJavaVM waiting for non-daemon threads to exit
D/ACRA    (  660): Waiting for Toast + worker...
D/dalvikvm(   52): GC freed 3929 objects / 166424 bytes in 157ms
D/dalvikvm(  660): GREF has decreased to 199
D/dalvikvm(  660): GC freed 495 objects / 497968 bytes in 165ms
D/ACRA    (  660): Sending report 569291c5-64df-4491-91f9-f89f01f7f053
D/ACRA    (  660): Connect to https://docs.google.com/spreadsheet/formResponse?formkey=dFNyNHJJQ1ZvdVhlblg3aVl1LVNOSGc6MQ&ifq
W/WindowManager(   52): App freeze timeout expired.
W/WindowManager(   52): Force clearing freeze: AppWindowToken{43d7b688 token=HistoryRecord{43cf1898 com.example.app/.MainActivity}}
D/dalvikvm(  660): GC freed 11315 objects / 1068344 bytes in 59ms
D/dalvikvm(  660): GC freed 1302 objects / 353824 bytes in 48ms
D/ACRA    (  660): Sending request to https://docs.google.com/spreadsheet/formResponse?formkey=dFNyNHJJQ1ZvdVhlblg3aVl1LVNOSGc6MQ&ifq
D/dalvikvm(   52): GREF has decreased to 399
D/dalvikvm(  100): GC freed 1096 objects / 64416 bytes in 65ms
D/dalvikvm(   52): GC freed 3276 objects / 134560 bytes in 84ms
D/ACRA    (  660): #checkAndSendReports - finish
D/ACRA    (  660): Wait for Toast + worker ended. Kill Application ? true
E/AndroidRuntime(  660): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime(  660): java.lang.StackOverflowError
E/AndroidRuntime(  660):    at java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:49)
E/AndroidRuntime(  660):    at java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:41)
E/AndroidRuntime(  660):    at java.nio.ReadWriteHeapByteBuffer.<init>(ReadWriteHeapByteBuffer.java:45)
E/AndroidRuntime(  660):    at java.nio.BufferFactory.newByteBuffer(BufferFactory.java:40)
E/AndroidRuntime(  660):    at java.nio.ByteBuffer.wrap(ByteBuffer.java:87)
E/AndroidRuntime(  660):    at java.nio.charset.CharsetEncoder.isLegalReplacement(CharsetEncoder.java:692)
E/AndroidRuntime(  660):    at java.nio.charset.CharsetEncoder.replaceWith(CharsetEncoder.java:804)
E/AndroidRuntime(  660):    at java.nio.charset.CharsetEncoder.<init>(CharsetEncoder.java:205)
E/AndroidRuntime(  660):    at com.ibm.icu4jni.charset.CharsetEncoderICU.<init>(CharsetEncoderICU.java:75)
E/AndroidRuntime(  660):    at com.ibm.icu4jni.charset.CharsetICU.newEncoder(CharsetICU.java:74)
E/AndroidRuntime(  660):    at com.android.internal.util.FastXmlSerializer.setOutput(FastXmlSerializer.java:292)
E/AndroidRuntime(  660):    at com.android.internal.util.XmlUtils.writeMapXml(XmlUtils.java:180)
E/AndroidRuntime(  660):    at android.app.ApplicationContext$SharedPreferencesImpl.writeFileLocked(ApplicationContext.java:2757)
E/AndroidRuntime(  660):    at android.app.ApplicationContext$SharedPreferencesImpl.access$800(ApplicationContext.java:2510)
E/AndroidRuntime(  660):    at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2695)
E/AndroidRuntime(  660):    at com.example.app.MainActivity.preferenze(MainActivity.java:3473)
E/AndroidRuntime(  660):    at com.example.app.MainActivity.access$0(MainActivity.java:3439)
E/AndroidRuntime(  660):    at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2302)
E/AndroidRuntime(  660):    at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime(  660):    at com.example.app.MainActivity.preferenze(MainActivity.java:3473)
E/AndroidRuntime(  660):    at com.example.app.MainActivity.access$0(MainActivity.java:3439)
E/AndroidRuntime(  660):    at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2302)
E/AndroidRuntime(  660):    at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime(  660):    at com.example.app.MainActivity.preferenze(MainActivity.java:3473)
E/AndroidRuntime(  660):    at com.example.app.MainActivity.access$0(MainActivity.java:3439)
E/AndroidRuntime(  660):    at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2302)
E/AndroidRuntime(  660):    at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime(  660):    at com.example.app.MainActivity.preferenze(MainActivity.java:3473)
E/AndroidRuntime(  660):    at com.example.app.MainActivity.access$0(MainActivity.java:3439)
E/AndroidRuntime(  660):    at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2302)
E/AndroidRuntime(  660):    at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime(  660):    at com.example.app.MainActivity.preferenze(MainActivity.java:3473)
E/AndroidRuntime(  660):    at com.example.app.MainActivity.access$0(MainActivity.java:3439)
E/AndroidRuntime(  660):    at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2302)
E/AndroidRuntime(  660):    at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime(  660):    at com.example.app.MainActivity.preferenze(MainActivity.java:3473)
E/AndroidRuntime(  660):    at com.example.app.MainActivity.access$0(MainActivity.java:3439)
E/AndroidRuntime(  660):    at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2302)
E/AndroidRuntime(  660):    at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime(  660):    at com.example.app.MainActivity.preferenze(MainActivity.java:3473)
E/AndroidRuntime(  660):    at com.example.app.MainActivity.access$0(MainActivity.java:3439)
E/AndroidRuntime(  660):    at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2302)
E/AndroidRuntime(  660):    at android.app.ApplicationContext$SharedPreferencesImpl$EditorImpl.commit(ApplicationContext.java:2703)
E/AndroidRuntime(  660):    at com.example.app.MainActivity.preferenze(MainActivity.java:3473)
E/AndroidRuntime(  660):    at com.example.app.MainActivity.access$0(MainActivity.java:3439)
E/AndroidRuntime(  660):    at com.example.app.MainActivity$1.onSharedPreferenceChanged(MainActivity.java:2302)
E/AndroidRuntime(  660):    at android.app.ApplicationContext$SharedPreferencesImpl$EditorImp
D/dalvikvm(  660): GC freed 8661 objects / 994800 bytes in 65ms
D/dalvikvm(  660): threadid=31 wakeup: interrupted
I/Process (   52): Sending signal. PID: 660 SIG: 3
I/dalvikvm(  660): threadid=7: reacting to signal 3
I/dalvikvm(  660): Wrote stack trace to '/data/anr/traces.txt'
I/Process (  660): Sending signal. PID: 660 SIG: 9
I/ActivityManager(   52): Process com.example.app (pid 660) has died.
I/UsageStats(   52): Unexpected resume of com.android.launcher while already resumed in com.example.app
W/InputManagerService(   52): Got RemoteException sending setActive(false) notification to pid 660 uid 10028
4

3 に答える 3

1

アップデートにより、スタックオーバーフローエラーが発生しました。onSharedPreferenceChangedトリガーよりもcommitを呼び出すメソッド名preferenzeを呼び出しますonSharedPreferenceChanged。このような特定の数の「再帰的」呼び出しの後、ヒープスペースから抜け出します。そこからcommitを呼び出さないでください。

于 2012-12-30T20:17:47.837 に答える
0

問題は、設定xmlファイルではなく、MainActivityのレイアウトに起因します。

フラグメントがandroid:name属性で適切に宣言されていることを確認してください。

于 2012-12-30T19:14:31.737 に答える
0

見てみる

Could not find class 'android.content.ClipboardManager', referenced from method com.example.app.MainActivity.Copia

android.content.ClipboardManager は、API レベル 11 - Android 3.0 から利用できます。あなたの問題につながると思います。

于 2012-12-30T19:17:58.513 に答える