0

I am trying to run Jess on Terminal IDE (android), but when I try to run the following:

terminal++@192.168.0.102:~/sdcard/myJess$ dx --dex --output=jess.dex Jess71p2/lib/jess.jar

I get the message:

warning: Ignoring InnerClasses attribute for an anonymous inner class that doesn't come with an associated EnclosingMethod attribute. (This class was probably produced by a broken compiler.)
warning: Ignoring InnerClasses attribute for an anonymous inner class that doesn't come with an associated EnclosingMethod attribute. (This class was probably produced by a broken compiler.)
warning: Ignoring InnerClasses attribute for an anonymous inner class that doesn't come with an associated EnclosingMethod attribute. (This class was probably produced by a broken compiler.)
warning: Ignoring InnerClasses attribute for an anonymous inner class that doesn't come with an associated EnclosingMethod attribute. (This class was probably produced by a broken compiler.)
warning: Ignoring InnerClasses attribute for an anonymous inner class that doesn't come with an associated EnclosingMethod attribute. (This class was probably produced by a broken compiler.)

UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError
    at java.util.HashMap.makeTable(HashMap.java:569)
    at java.util.HashMap.doubleCapacity(HashMap.java:589)
    at java.util.HashMap.put(HashMap.java:419)
    at com.android.dx.rop.code.RegisterSpec.intern(RegisterSpec.java:71)
    at com.android.dx.rop.code.RegisterSpec.makeLocalOptional(RegisterSpec.java:124)
    at com.android.dx.rop.code.RegisterSpec.withReg(RegisterSpec.java:482)
    at com.android.dx.ssa.SsaRenamer$BlockRenamer$RenamingMapper.map(SsaRenamer.java:325)
    at com.android.dx.ssa.RegisterMapper.map(RegisterMapper.java:53)
    at com.android.dx.ssa.NormalSsaInsn.mapSourceRegisters(NormalSsaInsn.java:43)
    at com.android.dx.ssa.SsaRenamer$BlockRenamer.visitNonMoveInsn(SsaRenamer.java:555)
    at com.android.dx.ssa.NormalSsaInsn.accept(NormalSsaInsn.java:199)
    at com.android.dx.ssa.SsaBasicBlock.forEachInsn(SsaBasicBlock.java:957)
    at com.android.dx.ssa.SsaRenamer$BlockRenamer.process(SsaRenamer.java:341)
    at com.android.dx.ssa.SsaRenamer$1.visitBlock(SsaRenamer.java:146)
    at com.android.dx.ssa.SsaMethod.forEachBlockDepthFirstDom(SsaMethod.java:787)
    at com.android.dx.ssa.SsaRenamer.run(SsaRenamer.java:143)
    at com.android.dx.ssa.SsaConverter.convertToSsaMethod(SsaConverter.java:53)
    at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:100)
    at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:74)
    at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:269)
    at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:131)
    at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:85)
    at com.android.dx.command.dexer.Main.processClass(Main.java:299)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:278)
    at com.android.dx.command.dexer.Main.access$100(Main.java:56)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:229)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:250)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:136)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:113)
    at com.android.dx.command.dexer.Main.processOne(Main.java:247)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:183)
    at com.android.dx.command.dexer.Main.run(Main.java:139)
    at com.android.dx.command.dexer.Main.main(Main.java:120)
    at com.android.dx.command.Main.main(Main.java:89)
    at com.spartacusrex.spartacuside.external.dx.main(dx.java:14)
    at dalvik.system.NativeStart.main(Native Method)

I have tried other approaches, like connecting via ssh to other machine, but it is not available and fast as local. Does anyone know a solution or other method?

2 Answers2

1

Jess 7 is not compatible with Android. Jess 8, which will be released any day now, will be. So keep an eye on www.jessrules.com .

Ernest Friedman-Hill
  • 80,601
  • 10
  • 150
  • 186
0

You need to add --no-strict to dx options, and if you are facing OutOfMemory Exception, you should edit your dx script and extend the memory range :

dalvikvm -Xss262912 -Xmx500M -cp $APK com.spartacusrex.spartacuside.external.dx $@

Change the -Xmx500M to your required memory

That is, until you stop receiving OOM exception.

For me ,while dexing tools.jar from JDK's tools.jar, it's limit was -Xmx900M after which, no more memory could be allocated because my phone had around 900-990MBs free.

  • The next step after dexing the class files is to repack any remaining resource file from your jess.jar because dex file has no resources.
  • Observe the contents of that jar file with java command or with winrar or any file explorer and find resources folder(s). You'll probably find more than one such resources folders, extract all of those.
  • Make sure that your dex file has name classes.dex then repack all files together in a new jess_for_android.jar, keep all the resources in the same directory tree as they were in original jess.jar file

  • Lastly, when you try to use it, use dalvikvm command , not the java or you will(possibly) get errors :

    dalvikvm -cp path_To_your_repacked_jar Main_className $@
    

memory options -Xss and -Xmx are optional.

Hope this helps, If you get Jess tool working, please provide a link to it.

Harshiv
  • 376
  • 2
  • 17