Wednesday, July 9, 2014

How to solve Exception raised during rendering: java.lang.System.arraycopy([CI[CII)V in Android

So today, while writing an example for the JCG community, I came across the following exception, while trying to add an EditText element to my application:

Exception raised during rendering: java.lang.System.arraycopy([CI[CII)V

Despite the fact that I selected Android 4.4 (API 19) for my application, I noticed that the selected Android API in the Graphical Layout of my XML code was actually wrong:


So, the easy way, I clicked the dropdown to select again my initial option:


Note: the Wear versions don't support EditText elements and that's why we got the exception.
And of course, everything was fine after that:


Cheers!

28 comments:

  1. So Simple!! Thanks! Was frustrating me for a long time!

    ReplyDelete
    Replies
    1. Thank you very much, Darklessly!
      Go for it now, problem solved!

      Delete
    2. This comment has been removed by the author.

      Delete
    3. Thanks a lot!!!

      Delete
  2. Wow, that was easy... :-/
    Was struggeling a while whith this now!

    Do you know why the API20: Android L is not selectable, although it is installed in the SDK Manager?
    Or is it included in the 4.4W API?

    ReplyDelete
    Replies
    1. Ok, I forgot to include System Images in the SDK Manager.
      Now the API 20: Android L is also available and it works fine.

      Delete
    2. Hi Christian, thank you for your comment!

      As you probably know, too, Android L will be officially "launched" at late 2014, so till then, it 'll be in a pilot mode.

      Nevertheless, we are actually able to develop "L" apps, under some guidelines.

      To ensure that everything is set properly for "L development", try following the official guide: http://developer.android.com/preview/setup-sdk.html

      As you probably noticed, there is also a special reference for System Images, under the "Set Up Hardware and AVDs" paragraph.

      Delete
    3. Thanks for the information!
      Though I tried out the new API with my project and it worked with the according Emulators, clearly not with ones below L...
      Now I changed back my project to API 19 (project structure + graphical layout API)
      It looks good in the Android Studio design preview, but when I start the emulator (for API 19) it rearranges my controls and it doesn't really fit on the screen (same problem on the phone itself)
      did I f*** up my layout with temporary switching to L?
      I can't see the problem when developing, because the layout looks fine in the Preview...

      You must know in "File > Project Structure" the "Build Tool Version" is still set to "20.0.0" and doesn't allow any other values...
      Do you know this kind of problem?

      Delete
    4. Hi Christian,

      excuse me for the late response, but I had a lot of work during this week.

      I suggest keeping the same discpline for an independent project (same versions for "Target SDK" and "Compile With" - search for "Figure 1" in this link, if you misunderstood something: http://examples.javacodegeeks.com/android/core/app/fragment/android-fragment-tabs-example/ )

      This should solve your problem and if not, prefer KitKat instead of L, since L is not still so "stable".

      Delete
  3. Wow. These errors sometimes look ominous as F**K, like I'll never be able to figure it out, and my project is doomed. Yet, they end up being so simple it's STUPID…

    Thanks!

    ReplyDelete
    Replies
    1. The only positive from similar stories, is that you gain more and more experience about thinking simple while debugging :)

      Delete
  4. I have this problem and the only API option I have is 4.4W so how do I add other options? Please help. This is so frustrating!

    ReplyDelete
    Replies
    1. Hi,
      @Thodoris: hope it's ok to post now and then...?
      @question:
      which APIs are installed in the SDK Manager and which Android Development Kit is selected under "File > Project Structure"?
      Usually depending on these things you can select the API.

      Delete
    2. Hello Anonymoys!

      First of all, as a disclaimer, you should read my recent reply to Christian (July 20, 2014 at 5:11 AM). Once this is done, I guess that you only downloaded the latest versions of the required for Android Developement, tools, so what you have to do, to get over this, is to download a now-wear version of Android SDK, by clicking the "Android SDK Manager" icon in your Eclipse IDE (a selection like this http://snag.gy/elK1P.jpg, should be good, regarding Android KitKat)

      Delete
  5. Thodoris Bais yo the best. almost deleted my whole sample project coz of that error.

    thanks alot

    ReplyDelete
  6. I am using API20:4.4W and if i click on the arrow nothing gets displayed. i get only API20 version how can i add other versions. plz help me adding edit text is more important in my project.

    ReplyDelete
  7. thanks a lot man it works and also helped a lot ......thanks thanks a lot

    ReplyDelete
  8. Thank you very much. As simple as it is, you saved a lot of time.

    ReplyDelete
  9. Thank you very much for taking the time to post this. Much appreciated.

    ReplyDelete
  10. Thank you!!!! I was very frustrated about this issue , and so simple to solve!!!

    ReplyDelete
  11. really thank you save me

    ReplyDelete
  12. great help...!!!!

    ReplyDelete