gpt4 book ai didi

android - Proguard 混淆导致 getView 中的应用程序崩溃

转载 作者:行者123 更新时间:2023-12-02 03:54:17 25 4
gpt4 key购买 nike

花了几个小时,无法防止应用程序在混淆后崩溃。也四处寻找无果。如果有人能给我正确方向的提示,我将不胜感激。崩溃从 getView 获取(来源不明)

E/AndroidRuntime: FATAL EXCEPTION: main
E/AndroidRuntime: android.content.res.Resources$NotFoundException: Resource ID #0x0
E/AndroidRuntime: at android.content.res.Resources.getValue(Resources.java:1019)
E/AndroidRuntime: at android.content.res.Resources.getDrawable(Resources.java:663)
E/AndroidRuntime: at a.getDrawable(Unknown Source)
E/AndroidRuntime: at android.support.v7.internal.widget.TintManager.getDrawable(Unknown Source)
E/AndroidRuntime: at android.support.v7.internal.widget.TintManager.getDrawable(Unknown Source)
E/AndroidRuntime: at android.support.v7.widget.AppCompatImageHelper.setImageResource(Unknown Source)
E/AndroidRuntime: at android.support.v7.widget.AppCompatImageView.setImageResource(Unknown Source)
E/AndroidRuntime: at roncada.skyweather.DropZoneAdapter.getView(Unknown Source)
E/AndroidRuntime: at android.widget.AbsListView.obtainView(AbsListView.java:2222)
E/AndroidRuntime: at android.widget.ListView.makeAndAddView(ListView.java:1774)

开始的代码:

    @Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);

DropZoneAdapter adapter = new DropZoneAdapter(getActivity(), DZS);
getListView().setAdapter(adapter);

} //end postexecute

然后在适配器中:

类 DropZoneAdapter 扩展了 ArrayAdapter {

public DropZoneAdapter(Context context, ArrayList<DropZoneFragment.DZ_Row> sites) {
super(context, R.layout.row_layout, sites);
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
// Get the data item for this position

并且它在convertView中中断。

这是我的混淆规则:

-dontpreverify
-repackageclasses ''
-allowaccessmodification
-optimizations !code/simplification/arithmetic
#-keepattributes *Annotation*
-keep class android.support.v4.internal.** { *; }
-keep interface android.support.v4.internal.** { *; }
-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }
-keep class android.support.v7.widget.** { *; }
-keep interface android.support.v7.widget.** { *; }
-keep class android.support.v7.internal.** { *; }
-keep interface android.support.v7.internal.** { *; }
-keep public class * extends android.app.Activity
#-keep public class * extends android.support.v7.app.AppCompatActivity;
-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
-dontwarn android.support.**
-dontwarn com.google.common.**
-dontwarn org.apache.http.**
-dontwarn android.net.http.AndroidHttpClient
-dontwarn com.google.android.gms.**

非常感谢任何帮助。谢谢。

最佳答案

您应该保护您的Fragment免遭混淆。

-keep public class * extends android.app.Fragment

关于android - Proguard 混淆导致 getView 中的应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33182273/

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