0

So, I am trying to use JExcel to write data from an array into an excel sheet. This has to be done inside of an android. So, I have an activity set up to write the excel sheet.

public void addListenerOnButtonSync()
{
    final Context context = this;
    Button button = (Button) findViewById(R.id.buttonSync);
    button.setOnClickListener(new OnClickListener()
    {
        @Override
        public void onClick(View arg0)
        {
            try {
                write.main(null);
            } catch (RowsExceededException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (BiffException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (WriteException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    });
}

So, I have placed the call to write in an excel sheet as soon as a button is pressed on the android device. I am running into an error and I am thinking that it might be due to the multiple try/catch exceptions set up. How do we normally set up JExcel in android such that it writes to an excel sheet?

Here is the trace:

07-03 12:37:57.255: E/AndroidRuntime(697): FATAL EXCEPTION: main
07-03 12:37:57.255: E/AndroidRuntime(697): java.lang.VerifyError: org.initial.insurance.sync$1
07-03 12:37:57.255: E/AndroidRuntime(697):  at org.initial.insurance.sync.addListenerOnButtonSync(sync.java:40)
07-03 12:37:57.255: E/AndroidRuntime(697):  at org.initial.insurance.sync.onCreate(sync.java:33)
07-03 12:37:57.255: E/AndroidRuntime(697):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-03 12:37:57.255: E/AndroidRuntime(697):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
07-03 12:37:57.255: E/AndroidRuntime(697):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-03 12:37:57.255: E/AndroidRuntime(697):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-03 12:37:57.255: E/AndroidRuntime(697):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-03 12:37:57.255: E/AndroidRuntime(697):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-03 12:37:57.255: E/AndroidRuntime(697):  at android.os.Looper.loop(Looper.java:123)
07-03 12:37:57.255: E/AndroidRuntime(697):  at android.app.ActivityThread.main(ActivityThread.java:4627)
07-03 12:37:57.255: E/AndroidRuntime(697):  at java.lang.reflect.Method.invokeNative(Native Method)
07-03 12:37:57.255: E/AndroidRuntime(697):  at java.lang.reflect.Method.invoke(Method.java:521)
07-03 12:37:57.255: E/AndroidRuntime(697):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-03 12:37:57.255: E/AndroidRuntime(697):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-03 12:37:57.255: E/AndroidRuntime(697):  at dalvik.system.NativeStart.main(Native Method)
assylias
  • 321,522
  • 82
  • 660
  • 783
Gautam
  • 49
  • 5
  • Can you be more specific about the error you get (stack trace)? – assylias Jul 03 '12 at 07:57
  • yes, its basically giving me a java.lang.VerifyError. – Gautam Jul 03 '12 at 09:02
  • [Running a search on that error](http://stackoverflow.com/search?tab=relevance&q=[android]%20%2bjava.lang.verifyerror) shows several hints (like [this question](http://stackoverflow.com/q/4105578/829571) for example). – assylias Jul 03 '12 at 09:37

1 Answers1

1

I had the same problem, and as Assylias said, the answer is here (the last post).

You have to check your API in Properties → Order and Export.

Community
  • 1
  • 1
Jrs42
  • 456
  • 4
  • 6