[RESOLVED] DexOverflow Build Error, Some Confusion

I’ve seen several similar questions, so I hope I’m not wrong in postign this, but I’d like to understand this error and how to fix it, mostly because I don’t understand the process.

The error, probably seen before, that occurs when I build an android project:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:484)
at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:261)
at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:473)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:161)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)

/Users/jsc/Documents/GameDev/jME_Projects/VelocityY/nbproject/mobile-impl.xml:21: The following error occurred while executing this line:
/Users/jsc/Downloads/android-sdk-macosx/tools/ant/build.xml:888: The following error occurred while executing this line:
/Users/jsc/Downloads/android-sdk-macosx/tools/ant/build.xml:890: The following error occurred while executing this line:
/Users/jsc/Downloads/android-sdk-macosx/tools/ant/build.xml:902: The following error occurred while executing this line:
/Users/jsc/Downloads/android-sdk-macosx/tools/ant/build.xml:283: null returned: 2

What surprises me is that I didn’t have this issue earlier. The only things I’ve changed are:

  • Went from 3.0 to SDK 3.1 alpha 1
  • Inserted Lemur jars.

Are these really enough to create this error, which I is guess telling me that I have more than the supported number of methods? I even removed all the nifty jars, but no luck.

Regardless of the previous issue, what I don’t quite follow is how to fix it. From what I’ve gathered, I need to use ProGuard for code obfuscation and optimization, and perhaps use mult-dex to solve this? Are there any jME specific steps in this process, or is this general android stuff? You’ll have to forgive me, I haven’t worked on an android app to deployment in jME, only in the context of Android Studio, and I didn’t need to do this before.

Hi
This may help : http://stackoverflow.com/questions/27497553/build-tools-21-1-2-unexpected-top-level-exception

I Just searched google!

Well, right. I did find that. And I know I should be editing the gradle.build for this. But where is that file?

Do I have to rebuild the jme3.1 project as a gradle project rather than a netbeans project to fix this? Is there a way to fix this without rebuilding?

EDIT: Mind you, I’m looking this up as I go too, so any links are still appreciated.

I’m now getting this error:

/Users/jsc/Documents/GameDev/jME_Projects/VelocityY/nbproject/obfuscate-impl.xml:7: Can't read [/Applications/jmonkeyplatform.app/Contents/Resources/jmonkeyplatform/jdk/jre/lib/rt.jar] (Can't process class [apple/applescript/AppleScriptEngine.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7)))

Which I hear can be fixed by updating the Proguard question. Probably a really basic issue, but where do I specify the proguard version?

I’ve downloaded 5.1.2 and replaced the proguard in the android-sdk-macosx folder with my new proguard version, but the build still says I’m using proguard 4.7. I feel like I’m struggling over a fairly easy fix.

EDIT: The above still holds, but if I don’t obfuscate it, and use multidex, i get this:

UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: GC overhead limit exceeded

I’ve searched this up, and they all say to increase your heap size. But when I do, I keep getting this error. If even my CPU goes to 98% usage for 2 minutes, it errors out. Ideas?

I also get a lot of these warnings:

(org.codehaus.groovy.util.StringUtil$_tr_closure1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.```

Googling tells me it's nothing to worry about, but it's about the only output I see when I hit multi-dex mode, so i don't know whether to worry or not. It's all for groovy stuff, BTW.

Sry for maybe necro, but can u bring some light on how u solve this? I mean did u found gradle.build file that u can edit? Looks like it somewhere in Android SDK not in JME SDK. God, why is building already working application is so complicated for Android…

Unfortunately not @Dmitry. For now I’m just developing the game on my PC, and will port to android (read as “test on android”) in the future by either a) hoping someone figures out a solution to this or b) I’ll use android studio and the gradle process to figure it out. That will take me time, but those are the two options I have.

Yep, looks like it is imposible to build real android application in JME SDK. As “real” i mean something more complicated then blue cube :slight_smile:. At this weeken i did some stuff with gradle and Idea Community Edition and it works, but i still have several issues maybe cause i’m super noob at gradle. Unfortunately nor JME SDK nor ANDROID not like maven and we r all have to learn groovy and SDL

<myMessage>
   <randomGarbage>
      <lookItUp version="0.4.12 years ago"/>
   </randomGarbage>
   <sentence>
        <message>Ultimately you will be better off for it.</message>
        <scope>myMessage</scope>
   </sentence>
   <sentence>
        <message>Maven is a very ugly and user-hostile tool in general.</message>
   </sentence>

   <plugins>
      <configToDoStandardThings>
          <butDidntExist20YearsAgoSoYouMustManuallyConfigureIt/>
      </configToDoStandardThings>
   </plugins>
</myMessage>

…but I really hate maven. I’m convinced that my cracked teeth are from grinding them from daily maven usage.

Looks like u hate maven hard as i now hate gradle :grinning:, but trying to give it some love. I using gradle just 2 days and ofc i just know nothing yet about this tool. Even i think gradle have more advanced arhitecture, i still don’t want to learn new language and then SDL on top of it, but while i can’t use SDK i should do it.
I think ur POM.xml (is it right?:slight_smile:) looks ugly as u want to show it. And sometimes maven pom really looks like it, but to be honest i spend just like 15 minutes to configure maven pom to my desktop project in IntelliJ. Even i have my own assets folder not corresponding to SDK’s structuure. It was easy and fast. Gradle configuring requires to learn groovy basics and still it is looks like magic spells still, cause of DSL and cause i am noob at it.
Don’t really want to complain about gradle vs maven anyways cause i understand the fact that every new good tool u learned is worth when u gonna us it in ur job

P.S.: after sitting and learning tons of docs about gradle my 2 weekend nights i made decision to spend some time to test different tools to make games maybe even another engine but i still want to give JME credits and ask people how they using it to create real games, not toy applications. Gonna make new topic and take advices and opinions

Ultimately, I’m down to learn gradle. Frankly, I’m always down to learn new tools/architecture. But I’m a fullstack engineer working in scala for backend stuff. Learning new stuff 24/7 is part of the craft. And since I don’t have a time limits set on my game, I’m perfectly content taking my time to learn it, and learn it well.

@machspeeds To be honest at my job i learn almost every day too, but i still think i am pretty conservative(or lazy) if u know what i mean. I am glad to dive deeply in research of new tool if i really gonna use it and take profit. My philosophy is simple: there r billions of tools around u, u can’t learn them all, so just choose what u need to solve ur tasks better. Dat’s why i tried scala too (and now reading Kotlin manuals), done 2 utility applications with it, getting euphoria cause of features i learned, and never return to this language :slight_smile: cause of many other negative reasons. Whatever, looks like gradle is pretty nice tool, worth to learn and use, but while i am ok with maven and have all my big projects at job on maven, i don’t wanna risk and migrate to gradle untill i am gonna be skilled enough to make any kind of build process. And yes i don’t want to learn new script language and SDL, which usefull only with build tool, kind of overhead.

@Dmitry wanted to let you know I got a build working. It took me a day, and I now have a project I can apply changes too via diff to get it working. I created a project in Android Studio, copied all my project files over, and there were no problems.

Use the SimpleJmeAndroid example as a start. The gradle build works fine, except I had to remove the "src/main/assets" in the build.gradle file. My app seem to compile the assets anyway without it.

Let me know if you need help. I’d be glad to help. I don’t know how many android games have been written with jme3 that require using android studio, so just ping me and I’ll try to help.

@machspeeds thank u my friend! Sorry for a bit late responce, i’ve need to spend much time for my family cause my son was born! :blush: Now i am slowly returning to job and hobby.
As result of my gradle learning I did my build.gradle file and it works as i expected(make apk file). Can’t tell surely, but looks like i used SimpleJmeAndroid example as base.
Anyways, thank u so much for ur help suggestion. Hope in future i will be able to help u in some cases.

@machspeeds Oh, i had 1 question. When u using assets folder inside of ur gradle project r u able to use SDK for create materials, editing scenes and stuff?

2 Likes

Congratulation :slight_smile:

Just tried it, no you can not edit models, material ,…

In SDK, in Files → Import Project → External Projects Asset
supposed for this purpose i think.

This importer will create a project that only manages the external projects assets. No code or libraries will be imported.

The specified assets folder should be your games AssetManager root or in the classpath of your project.

A settings file will be created in your project directory.

I tried to import an asset folder using this way but it didn’t create any project !! :anguished:

@Ali_RS thank u!
Looks like one of the best solutions is to create full “BasicGame like”(i named it assets-project) project inside ur gradle project directory and use it in SDK like usually. Ofc in gradle u should set up resources dir properly.
So after u done this u can edit materials and scenes with SDK and it will automatically sync with ur gradle assets.

1 Like