Pregunta

After searching for similar questions/answers without success I'll try to explain my situation.

I've an Andorid game developed with LibGDX, which also uses the Google Play Games services.

My game is composed by several projects:

  1. google-play-services_lib (lib project provided by Google, unmodified)
  2. BaseGameUtils (lib project provided by Google, unmodified. depends on 1)
  3. odd-blocks (the principal project of the game)
  4. odd-blocks-android (basically the main activity class, depends on 1, 2, and 3)
  5. odd-blocks-desktop (for testing the game on desktop mode, depends on 3)

My problem is that, with the configuration shown, when I try to execute the odd-blocks-android project I obtain the following error:

[2014-03-08 19:04:22 - Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
[2014-03-08 19:04:22 - odd-blocks-andorid] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

Which is related to the "andorid-support-v4.jar", I'm sure to have only one version of this jar, as you can see in the images. There is a "solution" proposed in some questions to disable the private libraries in the build path configuration. In my case, if I do that, the game is executed but before starting there is a exception that says:

03-08 18:26:05.524: E/AndroidRuntime(15449): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.damsoft.oddblocks/com.damsoft.oddblocks.MainActivity}: java.lang.NullPointerException

There are also, some questions available about this second error message, that mentions that it is because the manifest is incorrect because does not have the activity registered. I'm sure that this is not my case, because I checked it, and also because my game worked before. In these questions they also mention that a way to resolve this error is to enable the "android private libraries" in the build path configuration screen, but then, I got the first error...

It is also important to mention that this error started to happen after the update to "Android SDK build-tools" v19 (currently 19.0.3).

I've been trying many things but nothing seems to solve the issue, maybe is something stupid... I don't know, but I'm out of ideas. I hope you can help :)

¿Fue útil?

Solución

Finally I found the problem.

It was the "gdx-backend-android.jar", and some bad luck.

I installed a nightly build of LibGDX that for some reason included the classes of the android-support-v4.jar that caused the conflict of versions.

My solution was as simple as re-download libgdx.

But as a general remark, it is important to notice that this error message could mean that some other lib includes duplicated classes. Not necessarily with the same file name. The only way I found to check this was to rename the jar files to zip, and check for the duplicated class files.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top