gpt4 book ai didi

android - 资源 NotFoundException

转载 作者:太空狗 更新时间:2023-10-29 13:52:42 27 4
gpt4 key购买 nike

我尝试构建 apk 的发布版本并在 Honor 5x (api 23) 上启动时出现错误:

Caused by: android.view.InflateException: Binary XML file line #25: Error inflating class com.google.android.gms.common.SignInButton
File res/color/abc_hint_foreground_material_light.xml from color state list resource ID #0x7f0d01e7

同时,应用程序不会在模拟器 (api 25) 上崩溃。我试图将此添加到混淆器规则中,但没有帮助:

-dontwarn com.google.android.gms.**
-keep class com.google.android.gms.** { *; }
-keepclassmembers class **.R$* {
public static <fields>;
}

构建类型:

release {
shrinkResources true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
debuggable true
minifyEnabled true
}

我使用 android studio 3.0 canary 1、支持库 25.3.1、构建工具 25.0.2 和 firebase-ui 1.2.0

请帮我找到解决这个问题的方法。

最佳答案

我在使用“shrinkResources true”时遇到了类似的问题。

后来我得到了引用这部分的帮助 Customize which resources to keep .

If there are specific resources you wish to keep or discard, create an XML file in your project with a tag and specify each resource to keep in the tools:keep attribute and each resource to discard in the tools:discard attribute. Both attributes accept a comma-separated list of resource names. You can use the asterisk character as a wild card.

在“res/raw/”路径下的“keep.xml”文件中添加白名单,用于保留因“shrinkResources true”而丢失的资源。

例如“res/raw/keep.xml”

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@layout/l_used*_c,@layout/l_used_a,@layout/l_used_b*"
tools:discard="@layout/unused2" />

关于android - 资源 NotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44119211/

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