Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不同分辨率的string.xml,资源混淆压缩后会出现ResourceNotFound的异常 #100

Closed
changety opened this issue Oct 8, 2016 · 11 comments

Comments

@changety
Copy link

changety commented Oct 8, 2016

比如:
popo_2016-10-08 11-09-02
下面的同名字符串,在运行时会报错

@simpleton
Copy link
Collaborator

收到,我晚些时候确认一下。

@simpleton
Copy link
Collaborator

我尝试在example复现,并没有出现问题。你可以看下AndResGuard-example的情况是否和你描述的相符。

@changety
Copy link
Author

changety commented Oct 10, 2016

这个问题可能并不一定能复现,我自己测试也没有复现,但确实收集到过这个异常

@simpleton
Copy link
Collaborator

可否把异常的callstack以及机型,sdk版本发出来呢?

@changety
Copy link
Author

android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f080016
at android.content.res.Resources.getResourcePackageName(Resources.java:1868)
at android.content.res.Resources.getYLThemeString(Resources.java:2891)
at android.content.res.Resources.getText(Resources.java:253)
at android.content.res.Resources.getString(Resources.java:349)
at android.content.Context.getString(Context.java:337)

@changety
Copy link
Author


popo_2016-10-10 14-50-15

@simpleton
Copy link
Collaborator

多谢反馈,我再排查一下问题。

@thearyong
Copy link

我也遇到同样的问题,在app 运行umeng分享的时候 crash.
1.异常信息:

android.content.res.Resources$NotFoundException: File res/mipmap-xxxhdpi-v4/ic_launcher.png from drawable resource ID #0x7f030000
                                                                       at android.content.res.Resources.openRawResourceFd(Resources.java:1315)
                                                                       at com.umeng.socialize.media.g$g.a(SourceFile:546)
                                                                       at com.umeng.socialize.media.g.i(SourceFile:219)
                                                                       at com.umeng.socialize.media.c.b(SourceFile:120)
                                                                       at com.umeng.socialize.media.c.a(SourceFile:61)
                                                                       at com.umeng.socialize.handler.UMQQSsoHandler.a(SourceFile:327)
                                                                       at com.umeng.socialize.handler.UMQQSsoHandler.g(SourceFile:304)
                                                                       at com.umeng.socialize.handler.UMQQSsoHandler.a(SourceFile:99)
                                                                       at com.umeng.socialize.c.a.a(SourceFile:404)
                                                                       at com.umeng.socialize.h.a(SourceFile:208)
                                                                       at com.umeng.socialize.h.b(SourceFile:198)
                                                                       at com.umeng.socialize.common.d.run(SourceFile:134)
                                                                       at android.os.Handler.handleCallback(Handler.java:739)
                                                                       at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                       at android.os.Looper.loop(Looper.java:148)
                                                                       at android.os.HandlerThread.run(HandlerThread.java:61)
                                                                    Caused by: java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed
                                                                       at android.content.res.AssetManager.openNonAssetFdNative(Native Method)
                                                                       at android.content.res.AssetManager.openNonAssetFd(AssetManager.java:426)

2.引用代码:

.withMedia(new UMImage(activity, R.mipmap.ic_launcher))

3.白名单:

andResGuard {
    mappingFile = file("./resource_mapping.txt")
    use7zip = true
    useSign = true
    keepRoot = false
    whiteList = [
            // your icon
//            "R.drawable.icon",
            "R.mipmap.*",
            // for fabric
            "R.string.com.crashlytics.*",

**4.机型:**Nexus 6 - 6.0系统

每次都必现,添加白名单了,后面还是提示可能被压缩,我不知是不是白名单规则填写有误?

@simpleton
Copy link
Collaborator

@thearyong 多谢反馈,ref #92

@thearyong
Copy link

thearyong commented Oct 11, 2016

@simpleton 感谢,找到原因了,是我之前把ic_launcher.png经过https://tinypng.com 处理过一次,并不是AndResGuard白名单问题。
解决方法:替换原来的ic_launcher.png,正常运行

@OsBelief
Copy link

OsBelief commented Oct 21, 2016

@thearyong ,请问这个报错和 https://tinypng.com 处理过有什么关系啊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants