我在我的 android 应用程序中遇到了这个奇怪的(对我来说)错误。我已经在许多设备(Galaxy SII、Google Nexus、Google Nexus S)上安装了这个应用程序,它运行良好。
但是对于华为手机,当我从服务器获取数据时,该应用程序一开始就崩溃了。
此错误的日志是:
06-05 10:36:25.312: W/System.err(20862): java.lang.NumberFormatException: Invalid int: ""
06-05 10:36:25.312: W/System.err(20862): a java.lang.Integer.invalidInt(Integer.java:138)
06-05 10:36:25.312: W/System.err(20862): at java.lang.Integer.parseInt(Integer.java:359)
06-05 10:36:25.312: W/System.err(20862):at java.lang.Integer.parseInt(Integer.java:332)
06-05 10:36:25.312: W/System.err(20862):at java.util.Calendar.getHwFirstDayOfWeek(Calendar.java:822)
06-05 10:36:25.312: W/System.err(20862): at java.util.Calendar.<init>(Calendar.java:753)
06-05 10:36:25.312: W/System.err(20862): at java.util.GregorianCalendar.<init>(GregorianCalendar.java:338)
06-05 10:36:25.312: W/System.err(20862): at java.util.GregorianCalendar.<init>(GregorianCalendar.java:239)
06-05 10:36:25.312: W/System.err(20862): at java.util.Calendar.getInstance(Calendar.java:1152)
06-05 10:36:25.312: W/System.err(20862): at org.apache.http.impl.cookie.DateUtils.<clinit>(DateUtils.java:81)
06-05 10:36:25.312: W/System.err(20862): at org.apache.http.impl.cookie.BasicExpiresHandler.parse(BasicExpiresHandler.java:58)
06-05 10:36:25.312: W/System.err(20862): at org.apache.http.impl.cookie.CookieSpecBase.parse(CookieSpecBase.java:95)
06-05 10:36:25.312: W/System.err(20862): at org.apache.http.impl.cookie.NetscapeDraftSpec.parse(NetscapeDraftSpec.java:144)
06-05 10:36:25.312: W/System.err(20862): at org.apache.http.impl.cookie.BestMatchSpec.parse(BestMatchSpec.java:125)
06-05 10:36:25.312: W/System.err(20862): at org.apache.http.client.protocol.ResponseProcessCookies.processCookies(ResponseProcessCookies.java:120)
06-05 10:36:25.312: W/System.err(20862): at org.apache.http.client.protocol.ResponseProcessCookies.process(ResponseProcessCookies.java:101)
06-05 10:36:25.312: W/System.err(20862): at org.apache.http.protocol.BasicHttpProcessor.process(BasicHttpProcessor.java:304)
06-05 10:36:25.315: W/System.err(20862): at org.apache.http.protocol.HttpRequestExecutor.postProcess(HttpRequestExecutor.java:319)
06-05 10:36:25.315: W/System.err(20862): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:464)
06-05 10:36:25.315: W/System.err(20862): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
06-05 10:36:25.315: W/System.err(20862): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
06-05 10:36:25.315: W/System.err(20862): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
06-05 10:36:25.315: W/System.err(20862): at it.mio.miaapp.SplashScreenActivity$RequestTask.doInBackground(SplashScreenActivity.java:225)
06-05 10:36:25.315: W/System.err(20862): at it.mio.miaapp.SplashScreenActivity$RequestTask.doInBackground(SplashScreenActivity.java:1)
06-05 10:36:25.315: W/System.err(20862): at android.os.AsyncTask$2.call(AsyncTask.java:264)
06-05 10:36:25.315: W/System.err(20862): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
06-05 10:36:25.315: W/System.err(20862): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
06-05 10:36:25.315: W/System.err(20862): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
06-05 10:36:25.315: W/System.err(20862): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
06-05 10:36:25.315: W/System.err(20862): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
06-05 10:36:25.315: W/System.err(20862): at java.lang.Thread.run(Thread.java:856)
06-05 10:36:25.318: W/System.err(20862): /data/system/carrierinfo.prop: open failed: ENOENT (No such file or directory)
06-05 10:36:25.325: W/System.err(20862): Illegal: "<" inside attribute value (position:START_TAG <carrierweek numeric='20416' carrier='T-mobile' firstdayofweek='1'>@35:5 in java.io.InputStreamReader@41bfef18)
06-05 10:36:25.332: W/System.err(20862): /data/system/carrierinfo.prop: open failed: ENOENT (No such file or directory)
06-05 10:36:25.335: W/System.err(20862): /data/system/carrierinfo.prop: open failed: ENOENT (No such file or directory)
06-05 10:36:25.342: W/System.err(20862): /data/system/carrierinfo.prop: open failed: ENOENT (No such file or directory)
06-05 10:36:25.345: W/System.err(20862): /data/system/carrierinfo.prop: open failed: ENOENT (No such file or directory)
06-05 10:36:25.595: E/dalvikvm(20862): GC_FOR_ALLOC freed 3044K, 17% free 17908K/21319K, paused 2ms+3ms
06-05 10:36:25.812: W/System.err(20862): /data/system/carrierinfo.prop: open failed: ENOENT (No such file or directory)
06-05 10:36:25.832: W/System.err(20862): /data/system/carrierinfo.prop: open failed: ENOENT (No such file or directory)
06-05 10:36:25.832: W/System.err(20862): /data/system/carrierinfo.prop: open failed: ENOENT (No such file or directory)
06-05 10:36:25.835: W/System.err(20862): /data/system/carrierinfo.prop: open failed: ENOENT (No such file or directory)
06-05 10:36:25.885: E/dalvikvm(20862): GC_CONCURRENT freed 5846K, 26% free 17411K/23495K, paused 2ms+3ms
06-05 10:36:26.042: W/System.err(20862): /data/system/carrierinfo.prop: open failed: ENOENT (No such file or directory)
06-05 10:36:26.072: W/System.err(20862): /data/system/carrierinfo.prop: open failed: ENOENT (No such file or directory)
06-05 10:36:26.108: W/System.err(20862): /data/system/carrierinfo.prop: open failed: ENOENT (No such file or directory)
06-05 10:36:26.115: W/System.err(20862): /data/system/carrierinfo.prop: open failed: ENOENT (No such file or directory)
06-05 10:36:26.172: E/dalvikvm(20862): GC_FOR_ALLOC freed 2180K, 16% free 19767K/23495K, paused 2ms+4ms
06-05 10:36:26.275: W/System.err(20862): /data/system/carrierinfo.prop: open failed: ENOENT (No such file or directory)
06-05 10:36:26.295: W/System.err(20862): /data/system/carrierinfo.prop: open failed: ENOENT (No such file or directory)
06-05 10:36:26.305: W/System.err(20862): /data/system/carrierinfo.prop: open failed: ENOENT (No such file or directory)
06-05 10:36:26.305: W/System.err(20862): /data/system/carrierinfo.prop: open failed: ENOENT (No such file or directory)
AsyncTask 中涉及从服务器检索数据的代码行是:
response = httpClient.execute(new HttpGet(uri[0]));
有什么线索吗?该应用程序不仅适用于华为。