I'm trying to use ICU-Project.org Library (ICU4J v55.1) in my android app which had a wonderful alternatives to Java Calendar such as Japanese and Islamic Calendars, but the jar file always cause a crash in eclipse or my app
i can't using it in my android app, but it's works 100% fine in a normal Java Project, so i don't know what it is the problem
first time, i copy the jar file to my lib folder then right click > add to build path
when i run the app in Android emulator, this method cause killing to IDE with below message:
Unable to execute dex: Java heap space
Java heap space
although I've increased the heap space as shown below, but nothing solved:
--launcher.XXMaxPermSize
2048M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
2048m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms2048m
-Xmx2048m
second time: I've removed the jar file, and adding it from (right click on MyApp > properties > Java Build Path > Libraries tab > add external jars
in Order and Export tab, the jar is unchecked
now when i run Android Emulator, it's works but my app crashes with below error:
08-27 18:46:06.635: I/dalvikvm(295): Could not find method com.ibm.icu.util.Calendar.getInstance, referenced from method com.c.cx.Main.onCreate
08-27 18:46:06.635: W/dalvikvm(295): VFY: unable to resolve static method 13898: Lcom/ibm/icu/util/Calendar;.getInstance ()Lcom/ibm/icu/util/Calendar;
08-27 18:46:06.665: D/dalvikvm(295): VFY: replacing opcode 0x71 at 0x0009
08-27 18:46:06.665: D/dalvikvm(295): VFY: dead code 0x000c-002b in Lcom/c/cx/Main;.onCreate (Landroid/os/Bundle;)V
08-27 18:46:06.805: D/AndroidRuntime(295): Shutting down VM
08-27 18:46:06.805: W/dalvikvm(295): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
08-27 18:46:06.815: E/AndroidRuntime(295): FATAL EXCEPTION: main
08-27 18:46:06.815: E/AndroidRuntime(295): java.lang.NoClassDefFoundError: com.ibm.icu.util.Calendar
08-27 18:46:06.815: E/AndroidRuntime(295): at com.c.cx.Main.onCreate(Main.java:15)
08-27 18:46:06.815: E/AndroidRuntime(295): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-27 18:46:06.815: E/AndroidRuntime(295): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
08-27 18:46:06.815: E/AndroidRuntime(295): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
08-27 18:46:06.815: E/AndroidRuntime(295): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-27 18:46:06.815: E/AndroidRuntime(295): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-27 18:46:06.815: E/AndroidRuntime(295): at android.os.Handler.dispatchMessage(Handler.java:99)
08-27 18:46:06.815: E/AndroidRuntime(295): at android.os.Looper.loop(Looper.java:123)
08-27 18:46:06.815: E/AndroidRuntime(295): at android.app.ActivityThread.main(ActivityThread.java:4627)
08-27 18:46:06.815: E/AndroidRuntime(295): at java.lang.reflect.Method.invokeNative(Native Method)
08-27 18:46:06.815: E/AndroidRuntime(295): at java.lang.reflect.Method.invoke(Method.java:521)
08-27 18:46:06.815: E/AndroidRuntime(295): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-27 18:46:06.815: E/AndroidRuntime(295): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-27 18:46:06.815: E/AndroidRuntime(295): at dalvik.system.NativeStart.main(Native Method)
my usage of the lib:
package com.c.cx;
import com.ibm.icu.util.Calendar;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;
public class Main extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Calendar cal = Calendar.getInstance();
Toast.makeText(getApplicationContext(), ""+cal.get(Calendar.YEAR), Toast.LENGTH_SHORT).show();
}
}
my JDK version: 1.6, I've changed it to 1.7, nothing solved.
please try it before you judge.