Android and ICU 5.0, androidicu5.0
I recently used ICU4J in my android project. When I deploy it on my mobile phone, an error occurs after it is started. The information is as follows:
Fatal exception: main
12345678910111213141516171819202122232425262728293031323334 |
java.lang.ExceptionInInitializerError at com.ibm.icu.text.SimpleDateFormat.<clinit>(SimpleDateFormat.java: 849 ) at com.ibm.icu.text.DateFormat.get(DateFormat.java: 1492 ) at com.ibm.icu.text.DateFormat.getDateInstance(DateFormat.java: 1191 ) at com.phonedev.myApp.calendar.TimeCursor.getLongDate(TimeCursor.java: 333 ) at com.phonedev.myApp.about.VersionInfo.getBuildDateTime(VersionInfo.java: 44 ) at com.phonedev.myApp.myAppActivity.onCreate(myAppActivity.java: 184 ) at android.app.Activity.performCreate(Activity.java: 5133 ) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1087 ) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2175 ) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2261 ) at android.app.ActivityThread.access$ 600 (ActivityThread.java: 141 ) at android.app.ActivityThread$H.handleMessage(ActivityThread.java: 1256 ) at android.os.Handler.dispatchMessage(Handler.java: 99 ) at android.os.Looper.loop(Looper.java: 137 ) at android.app.ActivityThread.main(ActivityThread.java: 5103 ) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java: 525 ) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java: 737 ) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java: 553 ) at dalvik.system.NativeStart.main(Native Method) Caused by: java.util.MissingResourceException: Could not find the bundle com/ibm/icu/impl/data/icudt50b/en_US at com.ibm.icu.impl.ResourceBundleWrapper.getBundleInstance(ResourceBundleWrapper.java: 109 ) at com.ibm.icu.util.UResourceBundle.instantiateBundle(UResourceBundle.java: 573 ) at com.ibm.icu.util.UResourceBundle.getBundleInstance(UResourceBundle.java: 145 ) at com.ibm.icu.util.UResourceBundle.getBundleInstance(UResourceBundle.java: 228 ) at com.ibm.icu.impl.CalendarData.<init>(CalendarData.java: 28 ) at com.ibm.icu.util.Calendar.setWeekData(Calendar.java: 4604 ) at com.ibm.icu.util.Calendar.<init>(Calendar.java: 1584 ) at com.ibm.icu.util.GregorianCalendar.<init>(GregorianCalendar.java: 391 ) at com.ibm.icu.util.GregorianCalendar.<init>(GregorianCalendar.java: 337 ) at com.ibm.icu.text.DateFormat$Field.<clinit>(DateFormat.java: 1787 ) ... 20 more</clinit></init></init></init></init></clinit> |
Solution
To solve this problem, download the jar files required by the ICU and import them all to the project. The project lacks the class.
You need to follow the steps below to download. tgz file that says "gzipped tar archive including the entire source package" U decompress the file and use ant to run the ICU4J build project to build a icu4j. jar file and put it in the lib directory of the project
It seems that the ICU source code is dependent on more files. I have added all the source code to it and it seems that all of them have been solved.
Edit: Just had these warnings: export rejecting 'com/ibm/icu/impl/data/icudt50b' d your rejecting 'com/ibm/icu/impl/data/icudt50b_root 'd dvmFindClassByName rejecting 'com/ibm/icu /impl/data/icudt50b 'd dvmFindClassByName rejecting 'com/ibm/icu/impl/data/icudt50b_en 'd dvmFindClassByName rejecting 'com/ibm/icu/impl/data/comment d' revoke rejecting 'com/ibm/icu/impl/data/icudt50b' d dvmFindClassByName rejecting 'com/ibm/icu/impl/data/comment 'd dvmFindClassByName rejecting 'com/ibm/icu /impl/data/icudt50b 'd dvmFindClassByName rejecting 'com/ibm/icu/impl/data/icudt50b_en 'd dvmFindClassByName rejecting 'com/ibm/icu/impl/data/comment d' revoke rejecting 'com/ibm/icu/impl/data/icudt50b' d dvmFindClassByName rejecting 'com/ibm/icu/impl/data/comment 'd dvmFindClassByName rejecting 'com/ibm/icu /impl/data/icudt50b 'd dvmFindClassByName rejecting 'com/ibm/icu/impl/data/icudt50b_en 'd dvmFindClassByName rejecting 'com/ibm/icu/impl/data/comment d' export rejecting 'com/ibm/icu/impl/data/icudt50b' d your rejecting 'com/ibm/icu/impl/data/icudt50b_res 'd dvmFindClassByName rejecting 'com/ibm/icu /impl/data/icudt50b 'd dvmFindClassByName rejecting 'com/ibm/icu/impl/data/icudt50b_en 'd dvmFindClassByName rejecting 'com/ibm/icu/impl/data/comment d' export rejecting 'com/ibm/icu/impl/data/icudt50b_res_index 'd your rejecting 'com/ibm/icu/impl/data/icudt50b' d dvmFindClassByName rejecting 'com/ibm/icu /impl/data/icudt50b _ @ calendar = gregorian 'd reply rejecting 'com/ibm/icu/impl/data/icudt50b' d dvmFindClassByName rejecting 'com/ibm/icu/impl/ data/icudt50b_en 'd dvmFindClassByName rejecting 'com/ibm/icu/impl/data/icudt50b_en_US't threadid = 11: thread exiting with uncaught exception (group = 0x00006a700)
Original address: http://www.itmmd.com/201410/32.html this article by Meng it people sort and release, reprint must indicate the source.