gpt4 book ai didi

android - react-native android 应用程序在发布 apk 时崩溃

转载 作者:行者123 更新时间:2023-11-29 15:00:28 26 4
gpt4 key购买 nike

我编写了一个使用 react-native-svg 的混合应用程序在 react-native View 中渲染 svg 图像。一切都很完美。今天,当我为我的应用程序创建发布 apk 并将其部署到模拟器时,它崩溃并出现错误:

E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: com.example.packagname, PID: 8574
java.lang.IllegalStateException: java.lang.NoSuchFieldException: mFill
at com.horcrux.svg.q.a(Unknown Source:78)
at com.horcrux.svg.i$1.a(Unknown Source:9)
at com.horcrux.svg.aa.a(Unknown Source:22)
at com.horcrux.svg.i.b(Unknown Source:14)
at com.horcrux.svg.i.a(Unknown Source:10)
at com.horcrux.svg.t.a(Unknown Source:104)
at com.horcrux.svg.t.c(Unknown Source:25)
at com.horcrux.svg.t.a(Unknown Source:7)
at com.facebook.react.uimanager.u.a(Unknown Source:5)
at com.facebook.react.uimanager.ag.a(Unknown Source:56)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.a(Unknown Source:34)
at com.facebook.react.uimanager.ag.d(Unknown Source:83)
at com.facebook.react.uimanager.ag.e(Unknown Source:17)
at com.facebook.react.uimanager.UIManagerModule.onBatchComplete(Unknown Source:27)
at com.facebook.react.bridge.z.d(Unknown Source:30)
at com.facebook.react.bridge.CatalystInstanceImpl$a.onBatchComplete(Unknown Source:14)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at com.facebook.react.bridge.queue.a.dispatchMessage(Unknown Source:0)
at android.os.Looper.loop(Looper.java:164)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(Unknown Source:16)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.NoSuchFieldException: mFill
at java.lang.Class.getField(Class.java:1601)
at com.horcrux.svg.q.a(Unknown Source:41)
at com.horcrux.svg.i$1.a(Unknown Source:9) 
at com.horcrux.svg.aa.a(Unknown Source:22) 
at com.horcrux.svg.i.b(Unknown Source:14) 
at com.horcrux.svg.i.a(Unknown Source:10) 
at com.horcrux.svg.t.a(Unknown Source:104) 
at com.horcrux.svg.t.c(Unknown Source:25) 
at com.horcrux.svg.t.a(Unknown Source:7) 
at com.facebook.react.uimanager.u.a(Unknown Source:5) 
at com.facebook.react.uimanager.ag.a(Unknown Source:56) 
at com.facebook.react.uimanager.ag.a(Unknown Source:34) 
at com.facebook.react.uimanager.ag.a(Unknown Source:34) 
at com.facebook.react.uimanager.ag.a(Unknown Source:34) 
at com.facebook.react.uimanager.ag.a(Unknown Source:34) 
at com.facebook.react.uimanager.ag.a(Unknown Source:34) 
at com.facebook.react.uimanager.ag.a(Unknown Source:34) 
at com.facebook.react.uimanager.ag.a(Unknown Source:34) 
at com.facebook.react.uimanager.ag.a(Unknown Source:34) 
at com.facebook.react.uimanager.ag.a(Unknown Source:34) 
at com.facebook.react.uimanager.ag.a(Unknown Source:34) 
at com.facebook.react.uimanager.ag.a(Unknown Source:34) 
at com.facebook.react.uimanager.ag.a(Unknown Source:34) 
at com.facebook.react.uimanager.ag.d(Unknown Source:83) 
at com.facebook.react.uimanager.ag.e(Unknown Source:17) 
at com.facebook.react.uimanager.UIManagerModule.onBatchComplete(Unknown Source:27) 
at com.facebook.react.bridge.z.d(Unknown Source:30) 
at com.facebook.react.bridge.CatalystInstanceImpl$a.onBatchComplete(Unknown Source:14) 
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 
at android.os.Handler.handleCallback(Handler.java:789) 
at android.os.Handler.dispatchMessage(Handler.java:98) 
at com.facebook.react.bridge.queue.a.dispatchMessage(Unknown Source:0) 
at android.os.Looper.loop(Looper.java:164) 
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(Unknown Source:16) 
at java.lang.Thread.run(Thread.java:764) 

只有当我从 proguard-rule.pro 文件中注释 -dontobfuscate 时,我才会看到这个问题。我想混淆我的 apk 代码(我无法控制它。)。我使用的混淆器文件与本例中所示的类似, https://github.com/magicismight/react-native-svg-example/blob/cfb788461efae0de367c97aadcc829cdeb959a8d/android/app/proguard-rules.pro

有没有人遇到过这个问题?关于如何在不启用 proguard-rules 文件中的 -dontobfuscate 的情况下阻止我的应用程序崩溃的任何建议?

编辑 我是 android 开发的新手,我是第一次尝试 proguard。关于如何调试此类问题的任何积极建议都将非常有帮助。

最佳答案

问题与proguard有关。正如现在在自述文件(或 this issue)中所述,您需要将以下行添加到您的 android/app/proguard-rules.pro 文件中:

-keep public class com.horcrux.svg.** {*;}

关于android - react-native android 应用程序在发布 apk 时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46764226/

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