Menu

#238 java.lang.RuntimeException: can not merge I and Z

Accepted
Bob Pan
None
Medium
dex2jar
Defect
2015-05-20
2015-05-06
pitaf
No

I am trying to rebuild an Android 'framework.jar' from a 'framework.odex' file.

The ODEX file has been obtained using an Android terminal emulator of the Android SDK, emulating an Android v22 platform.

The ODEX file has been converted into a DEX file using baksmali and smali V2.0.3 to produce a framework.dex file.

I'm using dex-2-jar V2.1 nightly build #43.

I get the following error:

-- Landroid/preference/MultiSelectListPreference$1;.onClick(Landroid/content/DialogInterface;IZ)
V java.lang.RuntimeException: can not merge I and Z
--

The summary error file contains this:

This file is generated by dex2jar

Please report this file to one of following link if possible (any one).
https://sourceforge.net/p/dex2jar/tickets/
https://bitbucket.org/pxb1988/dex2jar/issues
https://github.com/pxb1988/dex2jar/issues [no attachment support, not preferred]
dex2jar@googlegroups.com

There are 1 methods fail to translate.
2015-05-05 08:08:13 UTC
version: [dex-reader-2.1-SNAPSHOT, dex-reader-api-2.1-SNAPSHOT, dex-ir-2.1-SNAPSHOT, d2j-smali-2.1-SNAPSHOT, d2j-base-cmd-2.1-SNAPSHOT, dex-tools-2.1-SNAPSHOT, dex-translator-2.1-SNAPSHOT]
cmdline: [.\framework.dex]
env:
java.runtime.name: Java(TM) SE Runtime Environment
java.vm.version: 25.25-b02
java.vm.vendor: Oracle Corporation
java.vendor.url: http://java.oracle.com/
java.vm.name: Java HotSpot(TM) Client VM
java.vm.specification.name: Java Virtual Machine Specification
java.runtime.version: 1.8.0_25-b18
java.awt.graphicsenv: sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs: [...]\jdk1.8.0_25\jre\lib\endorsed
java.io.tmpdir: K:\TEMP\ java.vm.specification.vendor: Oracle Corporation
java.library.path: [...]\jdk1.8.0_25\bin
java.specification.name: Java Platform API Specification
java.class.version: 52.0
java.awt.printerjob: sun.awt.windows.WPrinterJob
java.specification.version: 1.8
java.class.path: [...]\dex2jar-2.1-SNAPSHOT\lib\antlr-runtime-3.5.2.jar;[...]\dex2jar-2.1-SNAPSHOT\lib\asm-debug-all-4.1.jar;[...]\dex2jar-2.1-SNAPSHOT\lib\d2j-base-cmd-2.1-SNAPSHOT.jar;
java.vm.specification.version: 1.8
java.home: [...]\jdk1.8.0_25\jre
java.specification.vendor: Oracle Corporation
java.vm.info: mixed mode
java.version: 1.8.0_25
java.ext.dirs: [...]\jdk1.8.0_25\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext
java.vendor: Oracle Corporation
java.vendor.url.bug: http://bugreport.sun.com/bugreport/

================= 0 ===================
Landroid/preference/MultiSelectListPreference$1;.onClick(Landroid/content/DialogInterface;IZ)V
java.lang.RuntimeException: can not merge I and Z
at com.googlecode.dex2jar.ir.TypeClass.merge(TypeClass.java:100)
at com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeRef.updateTypeClass(TypeTransformer.java:174)
at com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.provideAs(TypeTransformer.java:783)
at com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.enexpr(TypeTransformer.java:662)
at com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.exExpr(TypeTransformer.java:722)
at com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.exExpr(TypeTransformer.java:706)
at com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.enexpr(TypeTransformer.java:701)
at com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.exExpr(TypeTransformer.java:722)
at com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.exExpr(TypeTransformer.java:706)
at com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.s1stmt(TypeTransformer.java:813)
at com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.sxStmt(TypeTransformer.java:843)
at com.googlecode.dex2jar.ir.ts.TypeTransformer$TypeAnalyze.analyze(TypeTransformer.java:206)
at com.googlecode.dex2jar.ir.ts.TypeTransformer.transform(TypeTransformer.java:44)
at com.googlecode.d2j.dex.Dex2jar$2.optimize(Dex2jar.java:160)
at com.googlecode.d2j.dex.Dex2Asm.convertCode(Dex2Asm.java:433)
at com.googlecode.d2j.dex.ExDex2Asm.convertCode(ExDex2Asm.java:42)
at com.googlecode.d2j.dex.Dex2jar$2.convertCode(Dex2jar.java:128)
at com.googlecode.d2j.dex.Dex2Asm.convertMethod(Dex2Asm.java:528)
at com.googlecode.d2j.dex.Dex2Asm.convertClass(Dex2Asm.java:425)
at com.googlecode.d2j.dex.Dex2Asm.convertDex(Dex2Asm.java:441)
at com.googlecode.d2j.dex.Dex2jar.doTranslate(Dex2jar.java:170)
at com.googlecode.d2j.dex.Dex2jar.to(Dex2jar.java:270)
at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java:108)
at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:290)
at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:32)

.method public onClick(Landroid/content/DialogInterface;IZ)V
.registers 7
if-eqz p3, :L1
iget-object v0, p0, Landroid/preference/MultiSelectListPreference$1;->this$0:Landroid/preference/MultiSelectListPreference;
iget-object v1, p0, Landroid/preference/MultiSelectListPreference$1;->this$0:Landroid/preference/MultiSelectListPreference;
invoke-static { v1 }, Landroid/preference/MultiSelectListPreference;->access$200(Landroid/preference/MultiSelectListPreference;)Ljava/util/Set;
move-result-object v1
iget-object v2, p0, Landroid/preference/MultiSelectListPreference$1;->this$0:Landroid/preference/MultiSelectListPreference;
invoke-static { v2 }, Landroid/preference/MultiSelectListPreference;->access$100(Landroid/preference/MultiSelectListPreference;)[Ljava/lang/CharSequence;
move-result-object v2
aget-object v2, v2, p2
invoke-virtual { v2 }, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object v2
invoke-interface { v1, v2 }, Ljava/util/Set;->add(Ljava/lang/Object;)Z
move-result v1
invoke-static { v0, v1 }, Landroid/preference/MultiSelectListPreference;->access$076(Landroid/preference/MultiSelectListPreference;I)Z
:L0
return-void
:L1
iget-object v0, p0, Landroid/preference/MultiSelectListPreference$1;->this$0:Landroid/preference/MultiSelectListPreference;
iget-object v1, p0, Landroid/preference/MultiSelectListPreference$1;->this$0:Landroid/preference/MultiSelectListPreference;
invoke-static { v1 }, Landroid/preference/MultiSelectListPreference;->access$200(Landroid/preference/MultiSelectListPreference;)Ljava/util/Set;
move-result-object v1
iget-object v2, p0, Landroid/preference/MultiSelectListPreference$1;->this$0:Landroid/preference/MultiSelectListPreference;
invoke-static { v2 }, Landroid/preference/MultiSelectListPreference;->access$100(Landroid/preference/MultiSelectListPreference;)[Ljava/lang/CharSequence;
move-result-object v2
aget-object v2, v2, p2
invoke-virtual { v2 }, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object v2
invoke-interface { v1, v2 }, Ljava/util/Set;->remove(Ljava/lang/Object;)Z
move-result v1
invoke-static { v0, v1 }, Landroid/preference/MultiSelectListPreference;->access$076(Landroid/preference/MultiSelectListPreference;I)Z
goto :L0
.end method
--

Discussion

  • Bob Pan

    Bob Pan - 2015-05-07
    • summary: Cannot convert Android framework.dex (v22) --> java.lang.RuntimeException: can not merge I and Z
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
     I am trying to rebuild an Android 'framework.jar' from a 'framework.odex' file.
    
     The ODEX file has been obtained using an Android terminal emulator of the Android SDK, emulating an Android v22 platform.
    
    • status: New --> Accepted
    • assigned_to: Bob Pan
    • Priority: High --> Medium
     
  • Bob Pan

    Bob Pan - 2015-05-07
    invoke-interface { v1, v2 }, Ljava/util/Set;->add(Ljava/lang/Object;)Z
    move-result v1
    invoke-static { v0, v1 },  // v1 is boolean but used as integer
                 Landroid/preference/MultiSelectListPreference;->access$076(Landroid/preference/MultiSelectListPreference;I)Z
    

    the problem is caused by strict type calculation, because in java syntaxt, a boolean can not assign to an inteager. so dex2jar forbid merge type Z and I. It is simple to fix

    • modify the dex by hand and add the following code after move-result v1
        if-eqz v1, :LZERO
            const v1, 1
            goto :Lend
        :LZERO
            const v1, 0
        :Lend
    
    • OR modify the dex2jar code. return Type I when merge I and Z at com.googlecode.dex2jar.ir.TypeClass.merge(TypeClass.java:100)

    https://bitbucket.org/pxb1988/dex2jar/issue/1/javalangruntimeexception-can-not-merge-i
    http://sourceforge.net/p/dex2jar/tickets/237

     

    Last edit: Bob Pan 2015-05-07
    • Ram Kumar

      Ram Kumar - 2016-01-11
      Post awaiting moderation.
  • arnaud

    arnaud - 2015-05-20

    thank you I sought an answer to this problem

     

Log in to post a comment.