gpt4 book ai didi

Square 的 Okio 库引用中的 Android-Studio-1.2.RC Proguard 警告

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:51:14 25 4
gpt4 key购买 nike

使用 Android Studio:1.2.RC

我在 .gradle 中启用了混淆器:```

minifyEnabled=true


并将这些规则添加到我的 proguard-rules.pro 中:

-dontwarn com.squareup.**
-dontwarn okio.**


并将这些 lint 规则添加到我的 .gradle 文件中:

warningsAsErrors false
abortOnError false
disable 'InvalidPackage'

```

但是当我尝试在 Debug模式下运行应用程序时,我仍然收到这些警告:

```
Warning: okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Files
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class java.nio.file.Path
Warning: okio.Okio: can't find referenced class java.nio.file.OpenOption
Warning: okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning: there were 14 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
:app:proguardDebug FAILED

```

这太奇怪了,因为我还将这些规则/选项添加到我所有依赖于 OkHttp/Picasso 的库模块中,我不知道哪里出了问题,也许这是一个 Android Studio 错误?有没有人知道这个问题的线索?

我打开了一个issue在 github 上。

最佳答案

您已为

禁用警告
-dontwarn com.squareup.**
-dontwarn okio.**

但是包呢(如您发布的日志中所示)

-dontwarn org.codehaus
-dontwarn java.nio

无论哪种方式,忽略警告都不是一个好方法。

尽量避免像这样缩小这些类:

-keep public class org.codehaus.**
-keep public class java.nio.**

关于Square 的 Okio 库引用中的 Android-Studio-1.2.RC Proguard 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29886882/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com