gpt4 book ai didi

android - java.lang.RuntimeException : caused while executing doInBackground() in Xiaomi device only 错误

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

Google Play 商店仅在小米设备上显示崩溃(我无法重现)。请在下面找到崩溃日志。我也曾尝试在小米设备中重现此崩溃,但无法重现。

java.lang.RuntimeException: at android.os.AsyncTask$3.done (AsyncTask.java:309) at java.util.concurrent.FutureTask.finishCompletion (FutureTask.java:354) at java.util.concurrent.FutureTask.setException (FutureTask.java:223) at java.util.concurrent.FutureTask.run (FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run (AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:588) at java.lang.Thread.run (Thread.java:818) Caused by: java.lang.ExceptionInInitializerError: at in.betterbutter.android.emoji.EmojiParse$ParseAsync.doInBackground (EmojiParse.java:30) at in.betterbutter.android.emoji.EmojiParse$ParseAsync.doInBackground (EmojiParse.java:19) at android.os.AsyncTask$2.call (AsyncTask.java:295) at java.util.concurrent.FutureTask.run (FutureTask.java:237)

这是我的代码:

public class EmojiParse {

public void parse(JSONObject jsonObject) {
new ParseAsync().execute(jsonObject);
}

public class ParseAsync extends AsyncTask<JSONObject, Void, Void> {

@Override
protected Void doInBackground(JSONObject... params) {
JSONObject jsonObject = params[0];
try {
JSONArray jsonArray = jsonObject.getJSONArray("emojis");
for (int i = 0; i < jsonArray.length(); ++i) {
JSONObject object = jsonArray.getJSONObject(i);
String text = object.getString("text");
String code = object.getString("code");
String surrogates = StringEscapeUtils.unescapeJava(object.getString("surrogates"));


EmojiMap emojiMap = new EmojiMap();


emojiMap.hashSet.add(code);
emojiMap.displayMap.put(text, surrogates);
emojiMap.reverseMap.put(surrogates, text);

}
} catch (JSONException e) {
e.printStackTrace();
} catch (Exception e1) {
e1.printStackTrace();
}
return null;
}
}

}

最佳答案

在小米手机后台运行是有限制的

设置 -> '应用程序' ->已安装的应用程序-> '你的应用程序 -> 后台限制 -> 无限制

这是因为小米默认为每个应用程序使用电池优化。

检查此链接 here for example

使用给定的代码移动到设置页面

Intent intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", getPackageName(), null);
intent.setData(uri);
startActivity(intent);

解除限制。

关于android - java.lang.RuntimeException : caused while executing doInBackground() in Xiaomi device only 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47387854/

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