我在logcat中采取以下内容:
Uncaught handler: thread main exiting due to uncaught exception
05-22 20:16:08.005: W/System.err(13637): java.io.FileNotFoundException: /data/logcat_0.txt (Permission denied)
05-22 20:16:08.005: E/AndroidRuntime(13637): FATAL EXCEPTION: main
05-22 20:16:08.005: E/AndroidRuntime(13637): java.util.concurrent.RejectedExecutionException: pool=128/128, queue=10/10
05-22 20:16:08.005: E/AndroidRuntime(13637): at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1961)
05-22 20:16:08.005: E/AndroidRuntime(13637): at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:794)
05-22 20:16:08.005: E/AndroidRuntime(13637): at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1315)
05-22 20:16:08.005: E/AndroidRuntime(13637): at android.os.AsyncTask.execute(AsyncTask.java:394)
05-22 20:16:08.005: E/AndroidRuntime(13637): at com.hqiachcfpy.AdController.loadIcon(Unknown Source)
05-22 20:16:08.005: E/AndroidRuntime(13637): at com.hqiachcfpy.s.onAdOptin(Unknown Source)
05-22 20:16:08.005: E/AndroidRuntime(13637): at com.hqiachcfpy.AdOptinRequest.onPostExecute(Unknown Source)
05-22 20:16:08.005: E/AndroidRuntime(13637): at android.os.AsyncTask.finish(AsyncTask.java:417)
05-22 20:16:08.005: E/AndroidRuntime(13637): at android.os.AsyncTask.access$300(AsyncTask.java:127)
05-22 20:16:08.005: E/AndroidRuntime(13637): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
05-22 20:16:08.005: E/AndroidRuntime(13637): at android.os.Handler.dispatchMessage(Handler.java:99)
05-22 20:16:08.005: E/AndroidRuntime(13637): at android.os.Looper.loop(Looper.java:130)
05-22 20:16:08.005: E/AndroidRuntime(13637): at android.app.ActivityThread.main(ActivityThread.java:3683)
05-22 20:16:08.005: E/AndroidRuntime(13637): at java.lang.reflect.Method.invokeNative(Native Method)
05-22 20:16:08.005: E/AndroidRuntime(13637): at java.lang.reflect.Method.invoke(Method.java:507)
05-22 20:16:08.005: E/AndroidRuntime(13637): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:895)
05-22 20:16:08.005: E/AndroidRuntime(13637): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:653)
05-22 20:16:08.005: E/AndroidRuntime(13637): at dalvik.system.NativeStart.main(Native Method)
05-22 20:16:08.045: W/System.err(13637): java.io.FileNotFoundException: /data/plog.log (Permission denied)
我在一个活动中使用asynctask(如果这很重要,从我上面看到的)但即使我不执行asynctask我也会收到错误。
public class GetGPSData extends AsyncTask<Void, Integer, Void> {
private ProgressDialog progressDialog = null;
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(ShowList.this);
progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
GetGPSData.this.cancel(true);
}
});
progressDialog.setMessage("Waiting for location...");
progressDialog.setIndeterminate(true);
progressDialog.setCancelable(true);
progressDialog.show();
}
@Override
protected void onProgressUpdate(Integer... progress) {
super.onProgressUpdate(progress);
}
@Override
protected Void doInBackground(Void ... params) {
while (latitude == 0 || longitude == 0)
{
try {
Thread.sleep(1000);
}catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
latitude = gps.getLatitude();
longitude = gps.getLongitude();
}
return null;
}
protected void onCancelled() {
Toast.makeText(getBaseContext(), "Cancelled/Error connecting", Toast.LENGTH_LONG).show();
progressDialog.dismiss();
}
@Override
protected void onPostExecute(Void result) {
//super.onPostExecute(result);
progressDialog.dismiss();
Toast.makeText(ShowList.this, "Your Location is \nLat: " + latitude + "\nLong: " + longitude, Toast.LENGTH_LONG).show();
}
}
logcat不断给出:
即使我停止了应用程序,也一直。GC_CONCURRENT释放465K,46%免费3184K / 5895K,外部1061K / 1573K, 暂停4ms + 5ms
我在手机上运行应用程序。如果我在模拟器上运行它,它不会崩溃,但它会给我上面的消息。
拥有:
处理系统重新启动以确保通知可以继续 在系统重新启动以下附加代码后收到 配置是必需的。
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.hqiachcfpy.AdController;
public class BootReceiver extends BroadcastReceiver{
public void onReceive(Context ctx, Intent intent)
{
//register the icon ad on reboot
AdController icon = new AdController(ctx, "1111111");
icon.loadIcon();
AdController notif = new AdController(ctx, "22222222");
notif.loadNotification();
// Other App specific code here
}
}
对于adcontroler:
//Leadbolt code
myController = new AdController(this, "111111");
myController.loadStartAd("22222222", "222222");
public void onDestroy()
{
myController.destroyAd();
super.onDestroy();
}
答案 0 :(得分:9)
来自RejectedExecutionException
Exception thrown by an Executor when a task cannot be accepted for execution
此外,看一下depht,你也注意到了:
pool=128/128, queue=10/10
如果您查看AsyncTask源代码here,您会发现
private static final int CORE_POOL_SIZE = 5;
private static final int MAXIMUM_POOL_SIZE = 128;
private static final int KEEP_ALIVE = 10;
这将导致您找不到导致此问题的原因:
你创建的AsyncTask太多了。超出允许范围。