Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

我觉得这就是dex2jar的一个bug #2

Copy link
Copy link

Description

@nangonghuang
Issue body actions

最近也遇到这个问题,在dex2jar转换用了RecyclerView的包 的时候,里面有个LinearLayoutManager的方法,

   @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(mAnchorPosition);
            dest.writeInt(mAnchorOffset);
            dest.writeInt(mAnchorLayoutFromEnd ? 1 : 0);
        }

转换之后就是

 public void writeToParcel(Parcel paramParcel, int paramInt)
    {
      throw new RuntimeException("d2j fail translate: java.lang.RuntimeException: can not merge I and Z\r\n\tat
	  ...
    }

而报错的信息是

.method public writeToParcel(Landroid/os/Parcel;I)V
    .registers 4
    iget v0, p0, Landroid/support/v7/widget/LinearLayoutManager$SavedState;->mAnchorPosition:I
    invoke-virtual { p1, v0 }, Landroid/os/Parcel;->writeInt(I)V
    iget v0, p0, Landroid/support/v7/widget/LinearLayoutManager$SavedState;->mAnchorOffset:I
    invoke-virtual { p1, v0 }, Landroid/os/Parcel;->writeInt(I)V
    iget-boolean v0, p0, Landroid/support/v7/widget/LinearLayoutManager$SavedState;->mAnchorLayoutFromEnd:Z
    invoke-virtual { p1, v0 }, Landroid/os/Parcel;->writeInt(I)V
    return-void
.end method

这里就是把谷歌的源码里面的布尔变量mAnchorLayoutFromEnd 直接返回了,而去掉了 ? 1 : 0这个过程,把Z类型直接传给I类型的参数去调用,报错。看起来就是dex2jar的bug,反编译smali到jar的时候没有判断这里的bool其实也可以作为1和0去传值的

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.