我的应用程序开始冻结,在logcat中持续发出“E / dalvikvm:GC_EXPLICIT释放”消息。我不确定会出现什么问题。有时它开始很好,但有时冻结抛出这些消息。那么我应该在哪里寻找问题?它之前给了我一些Integer解析错误,但是当应用程序正常启动时它也给出了,所以我认为它没有相关性?
06-18 16:46:39.229 25269-25269/com.example.krusty.drugi D/memalloc﹕ /dev/pmem: Mapped buffer base:0x4bca7000 size:6205440 offset:4669440 fd:50
06-18 16:46:39.599 25269-25269/com.example.krusty.drugi D/memalloc﹕ /dev/pmem: Mapped buffer base:0x4c312000 size:12165120 offset:10629120 fd:53
06-18 16:46:39.829 25269-25269/com.example.krusty.drugi W/System.err﹕ java.lang.NumberFormatException: Invalid int: ""
06-18 16:46:39.839 25269-25269/com.example.krusty.drugi W/System.err﹕ at java.lang.Integer.invalidInt(Integer.java:138)
06-18 16:46:39.839 25269-25269/com.example.krusty.drugi W/System.err﹕ at java.lang.Integer.parseInt(Integer.java:359)
06-18 16:46:39.839 25269-25269/com.example.krusty.drugi W/System.err﹕ at java.lang.Integer.parseInt(Integer.java:332)
06-18 16:46:39.839 25269-25269/com.example.krusty.drugi W/System.err﹕ at java.util.Calendar.getHwFirstDayOfWeek(Calendar.java:807)
06-18 16:46:39.839 25269-25269/com.example.krusty.drugi W/System.err﹕ at java.util.Calendar.<init>(Calendar.java:745)
06-18 16:46:39.839 25269-25269/com.example.krusty.drugi W/System.err﹕ at java.util.GregorianCalendar.<init>(GregorianCalendar.java:338)
06-18 16:46:39.839 25269-25269/com.example.krusty.drugi W/System.err﹕ at java.util.GregorianCalendar.<init>(GregorianCalendar.java:239)
06-18 16:46:39.839 25269-25269/com.example.krusty.drugi W/System.err﹕ at java.util.Calendar.getInstance(Calendar.java:1086)
06-18 16:46:39.839 25269-25269/com.example.krusty.drugi W/System.err﹕ at com.example.krusty.drugi.MainActivity.ListDrwaer(MainActivity.java:227)
06-18 16:46:39.839 25269-25269/com.example.krusty.drugi W/System.err﹕ at com.example.krusty.drugi.MainActivity$JsonReadTask.onPostExecute(MainActivity.java:197)
06-18 16:46:39.839 25269-25269/com.example.krusty.drugi W/System.err﹕ at com.example.krusty.drugi.MainActivity$JsonReadTask.onPostExecute(MainActivity.java:152)
06-18 16:46:39.839 25269-25269/com.example.krusty.drugi W/System.err﹕ at android.os.AsyncTask.finish(AsyncTask.java:602)
06-18 16:46:39.839 25269-25269/com.example.krusty.drugi W/System.err﹕ at android.os.AsyncTask.access$600(AsyncTask.java:156)
06-18 16:46:39.839 25269-25269/com.example.krusty.drugi W/System.err﹕ at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:615)
06-18 16:46:39.849 25269-25269/com.example.krusty.drugi W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:99)
06-18 16:46:39.849 25269-25269/com.example.krusty.drugi W/System.err﹕ at android.os.Looper.loop(Looper.java:137)
06-18 16:46:39.849 25269-25269/com.example.krusty.drugi W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:4424)
06-18 16:46:39.849 25269-25269/com.example.krusty.drugi W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
06-18 16:46:39.849 25269-25269/com.example.krusty.drugi W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:511)
06-18 16:46:39.849 25269-25269/com.example.krusty.drugi W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
06-18 16:46:39.849 25269-25269/com.example.krusty.drugi W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
06-18 16:46:39.849 25269-25269/com.example.krusty.drugi W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)
06-18 16:46:41.279 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 808K, 13% free 9755K/11107K, paused 4ms+6ms
06-18 16:46:43.119 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 722K, 11% free 10073K/11299K, paused 6ms+13ms
06-18 16:46:44.429 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 986K, 13% free 10127K/11619K, paused 4ms+15ms
06-18 16:46:46.819 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1007K, 14% free 10161K/11683K, paused 4ms+16ms
06-18 16:46:48.139 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1012K, 14% free 10190K/11747K, paused 3ms+9ms
06-18 16:46:49.059 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 950K, 13% free 10282K/11747K, paused 4ms+10ms
06-18 16:46:50.229 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1021K, 14% free 10303K/11875K, paused 5ms+9ms
06-18 16:46:51.309 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1034K, 14% free 10311K/11875K, paused 8ms+18ms
06-18 16:46:52.239 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1013K, 13% free 10339K/11875K, paused 3ms+9ms
06-18 16:46:53.069 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1042K, 14% free 10340K/11939K, paused 2ms+10ms
06-18 16:46:53.859 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1024K, 14% free 10358K/11939K, paused 3ms+10ms
06-18 16:46:54.769 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1042K, 14% free 10359K/11939K, paused 2ms+9ms
06-18 16:46:55.739 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1040K, 14% free 10361K/11939K, paused 3ms+9ms
06-18 16:46:56.709 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1043K, 14% free 10361K/11939K, paused 3ms+12ms
06-18 16:46:57.679 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1040K, 14% free 10364K/11939K, paused 3ms+10ms
06-18 16:46:58.629 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1040K, 14% free 10367K/11939K, paused 3ms+12ms
06-18 16:46:59.569 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1043K, 14% free 10367K/11939K, paused 3ms+10ms
06-18 16:47:00.589 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1040K, 14% free 10369K/11939K, paused 3ms+9ms
06-18 16:47:01.489 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1043K, 14% free 10369K/11939K, paused 4ms+11ms
06-18 16:47:02.389 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1040K, 14% free 10372K/11939K, paused 3ms+11ms
06-18 16:47:03.199 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1043K, 14% free 10372K/11939K, paused 3ms+10ms
06-18 16:47:03.939 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1040K, 14% free 10375K/11939K, paused 3ms+9ms
06-18 16:47:04.709 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1043K, 14% free 10375K/11939K, paused 3ms+9ms
06-18 16:47:05.559 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1040K, 14% free 10378K/11939K, paused 3ms+9ms
06-18 16:47:06.369 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1043K, 14% free 10378K/11939K, paused 2ms+10ms
06-18 16:47:07.109 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1043K, 14% free 10378K/11939K, paused 2ms+9ms
06-18 16:47:07.939 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1040K, 14% free 10380K/11939K, paused 3ms+8ms
06-18 16:47:08.779 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1043K, 14% free 10380K/11939K, paused 3ms+10ms
06-18 16:47:09.519 25269-25269/com.example.krusty.drugi E/dalvikvm﹕ GC_EXPLICIT freed 1038K, 14% free 10386K/11939K, paused 3ms+9ms
答案 0 :(得分:1)
NumberFormatException:无效的int:&#34;&#34;
在第227行打开您的代码,归档MainActivity.java
。
您正在解析一个Integer
(似乎与Calendar
),即&#34;&#34;,抛出NumberFormatException
,因为&#34;&#34;不被认为是一个数字,不像&#34; 0&#34;。
要解决您的问题,请检查您向Calendar
提供的内容。其中一个参数应该是这种情况&#34;&#34;,这是无效的。
您可以通过检查null
并使用TextUtils.isEmpty()
清空字符串来避免这种情况。