草庐IT

android - 未捕获的翻译 SimException : dx. rop.cst.CstInterfaceMethodRef 无法转换为 com.android.dx.rop.cst.CstMethodRef (Proguard)

coder 2023-12-04 原文

我的团队和我一直在努力解决我们在进入 Beta 版之前尝试混淆我们的 Android 应用程序时遇到的异常。

我们得到的异常是:

Error:Uncaught translation error: com.android.dx.cf.code.SimException: com.android.dx.rop.cst.CstInterfaceMethodRef cannot be cast to com.android.dx.rop.cst.CstMethodRef
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
<a href="syncProject">Re-download dependencies and sync project (requires network)</a></li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
<a href="stopGradleDaemons">Stop Gradle build processes (requires restart)</a></li><li>Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.</li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

我们正在尝试追踪在 Proguarding 期间发生此错误的位置,但不是非常熟悉 Proguard 以了解如何找到发生故障的位置。

有什么办法可以看出这个翻译错误发生在哪里?如果我知道强制转换异常在我的代码中是什么/在哪里,也许我可以修复它。网上有引用资料指出 Google Play 服务可能会导致其他 sdk 出现问题,但我们已经使用了依赖工具,发现它在所有 sdk 中都正确链接到 8.4.0。

我们的应用程序还使用了 multiDexEnabled true 标志。

这是我们的 proguard 文件:

# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /development/adt-bundle-mac/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

# (1)Annotations and signatures
-keepattributes *Annotation*,EnclosingMethod,Signature,InnerClasses

-keepnames class com.fasterxml.jackson.** { *; }

# (2)Simple XML
-keep public class org.simpleframework.**{ *; }
-keepclasseswithmembernames class javax.xml.stream.** { *; }
### Simple XML SERIALIZER SETTINGS
-keepclassmembers,allowobfuscation class * {
    @org.simpleframework.xml.* <fields>;
    @org.simpleframework.xml.* <init>(...);
}
-keep class javax.xml.stream.**{ *; }
-keep class org.simpleframework.xml.**{ *; }

# Ignore warnings: We are not using DOM model
#-dontwarn com.fasterxml.jackson.databind.ext.DOMSerializer
-dontwarn com.fasterxml.jackson.databind.ext.*
-dontwarn org.apache.http.**

# Keep the pojos used by GSON or Jackson
-keep class com.futurice.project.models.pojo.** { *; }

# Keep Jackson stuff
-dontwarn org.codehaus.**
-dontwarn com.bea.xml.stream.**
-dontwarn com.google.android.gms.*
-dontwarn javax.xml.stream.*
-dontwarn javax.annotation.**
-dontwarn sun.misc.Unsafe
-dontwarn com.google.j2objc.annotations.Weak
-dontwarn java.lang.ClassValue
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.*
-dontwarn org.apache.**
-dontwarn org.simpleframework.xml.stream.*
-dontwarn rx.internal.util.unsafe.*

# Keep leakcanary stuff
-dontwarn com.squareup.haha.**
-dontwarn com.squareup.leakcanary.**

# Marshmallow removed Notification.setLatestEventInfo()
-dontwarn android.app.Notification

# warnings
-dontwarn butterknife.internal.*
-dontwarn com.conviva.streamerProxies.*
-dontwarn com.anvato.**
-dontwarn com.apptentive.android.sdk.**
-dontwarn com.comscore.instrumentation.**
-dontwarn com.squareup.okhttp.**
-dontwarn com.urbanairship.json.**
-dontwarn tv.freewheel.renderers.html.*

# notes
-dontnote com.android.vending.**
-dontnote com.anvato.**
-dontnote com.conviva.**
-dontnote com.facebook.stetho.inspector.**
-dontnote com.google.android.gms.**
-dontnote com.google.gson.internal.**
-dontnote com.google.vending.**
-dontnote com.squareup.okhttp.**
-dontnote com.urbanairship.**
-dontnote tv.freewheel.extension.medialets.**
-dontnote org.apache.**
-dontnote org.json.**

#Note: duplicate definition of library class
-dontnote android.net.http.**


# For RxJava:
-dontwarn org.mockito.**
-dontwarn org.junit.**
-dontwarn org.robolectric.**
-dontwarn rx.md.internal.schedulers.NewThreadWorker

#-ignorewarnings

-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
#-keep public class * extends android.content.ContentProvider
#-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
##-keep public class com.android.vending.licensing.ILicensingService
#-keep public class com.fasterxml.jackson.databind.ObjectMapper

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

#-keepclasseswithmembernames class * {
#   public onStart();
#}

-keep public class com.fasterxml.jackson.** {
  public void set*(***);
  public *** get*();
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
    public static final android.os.Parcelable$Creator *;
    public void set*(***);
    public *** get*();
}

-keep class * {
    public void *(android.view.View);
}

如果您需要任何更多信息,请告诉我,我很乐意提供,目前这阻碍了我们发布测试版的能力。

最佳答案

所以对我们来说,解决方案似乎是删除:

-keep class * {
    public void *(android.view.View);
}

来自 Proguard,因为在将其与各种库一起使用时肯定存在一些冲突。我希望这能帮助其他遇到这个问题的人,因为我们在这个问题上被困了 6 天。

应该注意的是,您随后应该明确添加对点击处理程序的引用或至少缩小范围,请在此处查看此规则的来源:Android Proguard - how to keep onClick handlers only referenced from XML layouts

关于android - 未捕获的翻译 SimException : dx. rop.cst.CstInterfaceMethodRef 无法转换为 com.android.dx.rop.cst.CstMethodRef (Proguard),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37053305/

有关android - 未捕获的翻译 SimException : dx. rop.cst.CstInterfaceMethodRef 无法转换为 com.android.dx.rop.cst.CstMethodRef (Proguard)的更多相关文章

  1. ruby - 如何让Ruby捕获线程中的语法错误 - 2

    我正在尝试使用ruby​​编写一个双线程客户端,一个线程从套接字读取数据并将其打印出来,另一个线程读取本地数据并将其发送到远程服务器。我发现的问题是Ruby似乎无法捕获线程内的错误,这是一个示例:#!/usr/bin/rubyThread.new{loop{$stdout.puts"hi"abc.putsefsleep1}}loop{sleep1}显然,如果我在线程外键入abc.putsef,代码将永远不会运行,因为Ruby将报告“undefinedvariableabc”。但是,如果它在一个线程内,则没有错误报告。我的问题是,如何让Ruby捕获这样的错误?或者至少,报告线程中的错误?

  2. 安卓apk修改(Android反编译apk) - 2

    最近因为项目需要,需要将Android手机系统自带的某个系统软件反编译并更改里面某个资源,并重新打包,签名生成新的自定义的apk,下面我来介绍一下我的实现过程。APK修改,分为以下几步:反编译解包,修改,重打包,修改签名等步骤。安卓apk修改准备工作1.系统配置好JavaJDK环境变量2.需要root权限的手机(针对系统自带apk,其他软件免root)3.Auto-Sign签名工具4.apktool工具安卓apk修改开始反编译本文拿Android系统里面的Settings.apk做demo,具体如何将apk获取出来在此就不过多介绍了,直接进入主题:按键win+R输入cmd,打开命令窗口,并将路

  3. ruby-on-rails - 无法在 Rails 助手中捕获 block 的输出 - 2

    我在使用自定义RailsFormBuilder时遇到了问题,从昨天晚上开始我就发疯了。基本上我想对我的构建器方法之一有一个可选block,以便我可以在我的主要content_tag中显示其他内容。:defform_field(method,&block)content_tag(:div,class:'field')doconcatlabel(method,"Label#{method}")concattext_field(method)capture(&block)ifblock_given?endend当我在我的一个Slim模板中调用该方法时,如下所示:=f.form_field:e

  4. ruby - 在 ruby​​ 中生成一个进程,捕获 stdout,stderr,获取退出状态 - 2

    我想从ruby​​rake脚本运行一个可执行文件,比如foo.exe我希望将foo.exe的STDOUT和STDERR输出直接写入我正在运行rake任务的控制台.当进程完成时,我想将退出代码捕获到一个变量中。我如何实现这一目标?我一直在玩backticks、process.spawn、system但我无法获得我想要的所有行为,只有部分更新:我在Windows上,在标准命令提示符下,而不是cygwin 最佳答案 system获取您想要的STDOUT行为。它还返回true作为零退出代码,这可能很有用。$?填充了有关最后一次system调

  5. ruby - 捕获 Ruby Logger 输出以进行测试 - 2

    我有一个像这样的ruby​​类:require'logger'classTdefdo_somethinglog=Logger.new(STDERR)log.info("Hereisaninfomessage")endend测试脚本行如下:#!/usr/bin/envrubygem"minitest"require'minitest/autorun'require_relative't'classTestMailProcessorClasses当我运行这个测试时,out和err都是空字符串。我看到消息打印在stderr上(在终端上)。有没有办法让Logger和capture_io一起玩得

  6. ruby - Capistrano 中的执行、测试和捕获命令有什么区别? - 2

    关于SSHkit-Github它说:Allbackendssupporttheexecute(*args),test(*args)&capture(*args)来自SSHkit-Rubydoc,我明白execute实际上是test的别名?test之间有什么区别?,execute,capture在Capistrano/SSHKit中我应该什么时候使用? 最佳答案 执行只是执行命令。使用非0退出引发错误。测试方法的行为与execute完全相同,但是它返回bool值(true如果命令以0退出,而false否则)。它通常用于控制任务中的流程

  7. ruby - 如何捕获 ruby​​ 中的所有异常? - 2

    我们如何捕获或/和处理ruby​​中所有未处理的异常?例如,这样做的动机可能是将某种异常记录到不同的文件或发送电子邮件给系统管理。在Java中我们会做Thread.setDefaultUncaughtExceptionHandler(UncaughtExceptionHandlerex);在Node.js中process.on('uncaughtException',function(error){/*code*/});在PHP中register_shutdown_function('errorHandler');functionerrorHandler(){$error=error_

  8. ruby - 正则表达式 - 保存重复捕获的组 - 2

    这就是我做的a="%span.rockets#diamonds.ribbons.forever"a=a.match(/(^\%\w+)([\.|\#]\w+)+/)putsa.inspect这是我得到的#这就是我想要的#帮助?我尝试过但失败了:( 最佳答案 通常,您不能获得任意数量的捕获组,但如果您使用扫描,您可以为您想要捕获的每个标记获得一个匹配:a="%span.rockets#diamonds.ribbons.forever"a=a.scan(/^%\w+|\G[.|#]\w+/)putsa.inspect["%span","

  9. ruby - 如何捕获所有 HTTP 流量(本地代理) - 2

    我希望访问我机器上的所有HTTP流量(我的Windows机器-不是服务器)。据我了解,拥有一个本地代理是所有流量路线的必经之路。我一直在谷歌搜索但未能找到任何资源(关于Ruby)来帮助我。非常感谢任何提示或链接。 最佳答案 WEBrick中有一个HTTP代理(Rubystdlib的一部分)和here's一个实现示例。如果你喜欢生活在边缘,还有em-proxy伊利亚·格里戈里克。这postIlya暗示它似乎确实需要一些调整来解决您的问题。 关于ruby-如何捕获所有HTTP流量(本地代理)

  10. ruby-on-rails - Ruby 从 bash 脚本执行中捕获 stderr 输出 - 2

    我目前可以将stdout重定向到ruby​​/rails中的字符串变量,只需在bash中运行命令并将结果设置为我的字符串变量,如下所示。val=%x[#{cmd}]其中cmd是表示bash命令的字符串。但是,这仅捕获stdout,因为我想捕获stderr并将其设置为ruby​​中的字符串——有什么想法吗? 最佳答案 简单地重定向它:val=%x[#{cmd}2>&1]如果您只想从stderr捕获输出,请在将其复制到fd2后关闭stdout的文件描述符。val=%x[#{cmd}2>&1>/dev/null]

随机推荐