shwenzhang / AndResGuard

proguard resource for Android by wechat team
Apache License 2.0
8.54k stars 1.54k forks source link

资源压缩之后遇到个问题 #189

Closed aolphn closed 7 years ago

aolphn commented 7 years ago
2017-09-06 14:44:39 964  09-06 14:44:39.957  5853  5853 D Error   : ERR: stack=java.lang.StackOverflowError: stack size 8MB
2017-09-06 14:44:39 964  09-06 14:44:39.957  5853  5853 D Error   :     at android.content.res.ThemedResourceCache.getThemedLocked(ThemedResourceCache.java:160)
2017-09-06 14:44:39 964  09-06 14:44:39.957  5853  5853 D Error   :     at android.content.res.ThemedResourceCache.get(ThemedResourceCache.java:92)
2017-09-06 14:44:39 965  09-06 14:44:39.957  5853  5853 D Error   :     at android.content.res.DrawableCache.getInstance(DrawableCache.java:45)
2017-09-06 14:44:39 965  09-06 14:44:39.957  5853  5853 D Error   :     at android.content.res.Resources.loadDrawable(Resources.java:2556)
2017-09-06 14:44:39 965  09-06 14:44:39.957  5853  5853 D Error   :     at android.content.res.MiuiResources.loadDrawable(MiuiResources.java:387)
2017-09-06 14:44:39 965  09-06 14:44:39.957  5853  5853 D Error   :     at android.content.res.Resources.getDrawable(Resources.java:824)
2017-09-06 14:44:39 968  09-06 14:44:39.957  5853  5853 D Error   :     at android.content.Context.getDrawable(Context.java:467)
2017-09-06 14:44:39 968  09-06 14:44:39.957  5853  5853 D Error   :     at android.view.View.setBackgroundResource(View.java:17225)
2017-09-06 14:44:39 976  09-06 14:44:39.957  5853  5853 D Error   :     at com.view.asim.view.FaceRelativeLayout.drawPoint(FaceRelativeLayout.java:414)
2017-09-06 14:44:39 983  09-06 14:44:39.957  5853  5853 D Error   :     at com.view.asim.view.FaceRelativeLayout$4.onPageSelected(FaceRelativeLayout.java:383)
2017-09-06 14:44:39 984  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.dispatchOnPageSelected(ViewPager.java:1961)
2017-09-06 14:44:39 984  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:664)
2017-09-06 14:44:39 984  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:630)
2017-09-06 14:44:39 984  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:611)
2017-09-06 14:44:39 985  09-06 14:44:39.957  5853  5853 D Error   :     at com.view.asim.view.FaceRelativeLayout$4.onPageSelected(FaceRelativeLayout.java:389)
2017-09-06 14:44:39 985  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.dispatchOnPageSelected(ViewPager.java:1961)
2017-09-06 14:44:39 986  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:664)
2017-09-06 14:44:39 986  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:630)
2017-09-06 14:44:39 986  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:611)
2017-09-06 14:44:39 986  09-06 14:44:39.957  5853  5853 D Error   :     at com.view.asim.view.FaceRelativeLayout$4.onPageSelected(FaceRelativeLayout.java:386)
2017-09-06 14:44:39 987  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.dispatchOnPageSelected(ViewPager.java:1961)
2017-09-06 14:44:39 987  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:664)
2017-09-06 14:44:39 987  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:630)
2017-09-06 14:44:39 988  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:611)
2017-09-06 14:44:40 012  09-06 14:44:39.957  5853  5853 D Error   :     at com.view.asim.view.FaceRelativeLayout$4.onPageSelected(FaceRelativeLayout.java:389)
2017-09-06 14:44:40 016  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.dispatchOnPageSelected(ViewPager.java:1961)
2017-09-06 14:44:40 016  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:664)
2017-09-06 14:44:40 016  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:630)
2017-09-06 14:44:40 016  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:611)
2017-09-06 14:44:40 017  09-06 14:44:39.957  5853  5853 D Error   :     at com.view.asim.view.FaceRelativeLayout$4.onPageSelected(FaceRelativeLayout.java:386)
2017-09-06 14:44:40 017  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.dispatchOnPageSelected(ViewPager.java:1961)
2017-09-06 14:44:40 017  09-06 14:44:39.957  5853  5853 D Error   :     at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:664)

如日志显示的会有栈溢出问题。不用AndResGuard压缩就没这问题,压缩了就有问题。按理说这个问题应该是代码本身的问题,我有点迷惑了。

simpleton commented 7 years ago

@zhangkehu 你看下callstack,似乎是有死循环的。

aolphn commented 7 years ago

是啊,但是不压缩这代码没死循环,可以正常运行,所以有点懵逼。

aolphn commented 7 years ago

我先自己解决死循环的问题吧,至于为什么压缩了会有这个问题我先不研究了。

simpleton commented 7 years ago

ok,如果还是有问题,可以把apk发我邮箱,我们一起看下

2017-09-06 15:43 GMT+08:00 zhangkehu notifications@github.com:

我先自己解决死循环的问题吧,至于为什么压缩了会有这个问题我先不研究了。

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/shwenzhang/AndResGuard/issues/189#issuecomment-327402632, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbvYhO7Wn2I7vbCfV4ZnEBwR40hjTmqks5sfk0JgaJpZM4PN8Sh .

aolphn commented 7 years ago

哦,我知道问题了,我通过context.getResources().getIdentifier(resId)获取了一部分图片资源,这些资源没有加入白名单,所以走入异常分支了。