收缩Android使崩溃
我已经升级了Android Studio 因此,升级到最新版本后,我用以下内容更新了我的应用程序:收缩Android使崩溃,android,android-studio,exception,classcastexception,Android,Android Studio,Exception,Classcastexception,我已经升级了Android Studio 因此,升级到最新版本后,我用以下内容更新了我的应用程序: “shrinkResources true”,“minifyEnabled true” 不幸的是,我在一些设备上崩溃了,没有收缩,一切都很完美 以下是崩溃日志: java.lang.RuntimeException: at android.os.AsyncTask$3.done (AsyncTask.java:354) at java.util.concurrent.FutureTas
“shrinkResources true”
,“minifyEnabled true”
不幸的是,我在一些设备上崩溃了,没有收缩,一切都很完美
以下是崩溃日志:
java.lang.RuntimeException:
at android.os.AsyncTask$3.done (AsyncTask.java:354)
at java.util.concurrent.FutureTask.finishCompletion (FutureTask.java:383)
at java.util.concurrent.FutureTask.setException (FutureTask.java:252)
at java.util.concurrent.FutureTask.run (FutureTask.java:271)
at android.os.AsyncTask$SerialExecutor$1.run (AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
at java.lang.Thread.run (Thread.java:764)
Caused by: java.lang.ClassCastException:
at android.app.SharedPreferencesImpl.getInt (SharedPreferencesImpl.java:302)
at com.testApp.preference.WallpaperPreference.getLWPDay (WallpaperPreference.java:66)
at com.testApp.managerLWP.GetLWP.downloadHouseAds (GetLWP.java:64)
at com.testApp.managerLWP.GetLWP.doInBackground (GetLWP.java:40)
at com.testApp.managerLWP.GetLWP.doInBackground (GetLWP.java:22)
at android.os.AsyncTask$2.call (AsyncTask.java:333)
at java.util.concurrent.FutureTask.run (FutureTask.java:266)
下面是发生崩溃的名为的类
public class WallpaperPreference {
private Context context;
private SharedPreferences sharedPreferences;
public WallpaperPreference(Context context) {
this.context = context;
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
}
public void setLWPDay(int value) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt(Base.LWP_JSON_DAY, value);
editor.apply();
}
public int getLWPDay() {
return sharedPreferences.getInt(Base.LWP_JSON_DAY, 0);
}
}
我用过:
compileSdkVersion 29
buildToolsVersion '29.0.3'
解决办法可能是什么?谢谢
在发布模式中添加“可调试的true”
或
将proguard android优化proguard更改为“proguard android”
它对我有用你是否为你的应用程序设置了proguard规则。如果没有,这就是你的出发点。检查是否有任何帮助