尝试使用 Android AsyncTask 从服务器获取响应
我正在尝试学习如何使用 AsyncTask 类来验证其帐户存储在远程服务器和数据库上的用户。
我正在使用一个示例,到目前为止我有这段代码:
package com.problemio;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class LoginActivity extends Activity
{
private TextView textView;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
// Show form for login_email
final EditText loginEmail = (EditText) findViewById(R.id.login_email);
String name = loginEmail.getText().toString();
// Show field for password
final EditText password = (EditText) findViewById(R.id.password);
String text = password.getText().toString();
// Show button for submit
Button submit = (Button)findViewById(R.id.submit);
// Show options for create-profile and forgot-password
submit.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View v)
{
String email = loginEmail.getText().toString();
String pass = password.getText().toString();
sendFeedback(pass, email);
}
});
}
public void sendFeedback(String pass , String email)
{
Log.d( "1" , pass );
Log.d( "1" , email );
// Go to db and check if these r legit
// How do I do that? :)
ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
postParameters.add(new BasicNameValuePair("username", email ));
postParameters.add(new BasicNameValuePair("password", pass ));
}
private class DownloadWebPageTask extends AsyncTask<String, Void, String>
{
@Override
protected String doInBackground(String... urls)
{
Log.d( "Inner class: " , "Doing stuff in background" );
String response = "";
for (String url : urls) {
DefaultHttpClient client = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(url);
try {
HttpResponse execute = client.execute(httpGet);
InputStream content = execute.getEntity().getContent();
BufferedReader buffer = new BufferedReader(
new InputStreamReader(content));
String s = "";
while ((s = buffer.readLine()) != null) {
response += s;
}
} catch (Exception e) {
e.printStackTrace();
}
}
return response;
}
@Override
protected void onPostExecute(String result)
{
textView.setText(result);
}
}
public void readWebpage(View view)
{
DownloadWebPageTask task = new DownloadWebPageTask();
task.execute(new String[] { "http://www.myurl.com" });
}
}
并且我在 LogCat 中遇到了一些错误,例如:
02-23 10:51:45.587: D/AndroidRuntime(1670): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
02-23 10:51:45.587: D/AndroidRuntime(1670): CheckJNI is ON
02-23 10:51:47.037: D/AndroidRuntime(1670): Calling main entry com.android.commands.pm.Pm
02-23 10:51:47.118: W/ActivityManager(1180): No content provider found for permission revoke: file:///data/local/tmp/Problemio.apk
02-23 10:51:47.267: W/ActivityManager(1180): No content provider found for permission revoke: file:///data/local/tmp/Problemio.apk
02-23 10:51:47.467: I/PackageManager(1180): Removing non-system package:com.problemio
02-23 10:51:47.467: I/ActivityManager(1180): Force stopping package com.problemio uid=10041
02-23 10:51:47.467: I/ActivityManager(1180): Killing proc 1648:com.problemio/10041: force stop
02-23 10:51:47.477: W/ActivityManager(1180): Force removing ActivityRecord{4147f5d0 com.problemio/.LoginActivity}: app died, no saved state
02-23 10:51:47.518: I/ActivityManager(1180): Force finishing activity ActivityRecord{413e9e98 com.problemio/.ProblemioActivity}
02-23 10:51:47.587: W/InputDispatcher(1180): channel '4160fcd8 com.problemio/com.problemio.ProblemioActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
02-23 10:51:47.587: E/InputDispatcher(1180): channel '4160fcd8 com.problemio/com.problemio.ProblemioActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
02-23 10:51:47.607: I/WindowManager(1180): WIN DEATH: Window{416096c0 com.problemio/com.problemio.LoginActivity paused=false}
02-23 10:51:47.637: I/WindowManager(1180): WIN DEATH: Window{4160fcd8 com.problemio/com.problemio.ProblemioActivity paused=true}
02-23 10:51:47.637: W/InputDispatcher(1180): Attempted to unregister already unregistered input channel '4160fcd8 com.problemio/com.problemio.ProblemioActivity (server)'
02-23 10:51:47.667: I/WindowManager(1180): WINDOW DIED Window{4160fcd8 com.problemio/com.problemio.ProblemioActivity paused=true}
02-23 10:51:47.707: E/InputDispatcher(1180): Received spurious receive callback for unknown input channel. fd=206, events=0x8
02-23 10:51:48.157: D/dalvikvm(1180): GC_CONCURRENT freed 527K, 9% free 12067K/13255K, paused 10ms+43ms
02-23 10:51:48.587: W/NetworkManagementSocketTagger(1180): setKernelCountSet(10041, 0) failed with errno -2
02-23 10:51:48.587: W/NetworkManagementSocketTagger(1180): setKernelCountSet(10009, 1) failed with errno -2
02-23 10:51:48.598: I/PackageManager(1180): Package com.problemio codePath changed from /data/app/com.problemio-1.apk to /data/app/com.problemio-2.apk; Retaining data and using new
02-23 10:51:48.667: I/PackageManager(1180): Running dexopt on: com.problemio
02-23 10:51:49.247: D/dalvikvm(1681): DexOpt: load 54ms, verify+opt 86ms
02-23 10:51:49.307: W/PackageManager(1180): Code path for pkg : com.problemio changing from /data/app/com.problemio-1.apk to /data/app/com.problemio-2.apk
02-23 10:51:49.317: W/PackageManager(1180): Resource path for pkg : com.problemio changing from /data/app/com.problemio-1.apk to /data/app/com.problemio-2.apk
02-23 10:51:49.327: I/ActivityManager(1180): Force stopping package com.problemio uid=10041
02-23 10:51:49.517: D/PackageManager(1180): New package installed in /data/app/com.problemio-2.apk
02-23 10:51:49.808: I/ActivityManager(1180): Force stopping package com.problemio uid=10041
02-23 10:51:49.997: D/dalvikvm(1275): GC_EXPLICIT freed 235K, 6% free 11344K/12039K, paused 5ms+13ms
02-23 10:51:50.177: D/dalvikvm(1341): GC_EXPLICIT freed 168K, 4% free 9389K/9735K, paused 105ms+9ms
02-23 10:51:50.646: D/dalvikvm(1180): GC_EXPLICIT freed 448K, 10% free 12001K/13255K, paused 83ms+18ms
02-23 10:51:50.728: D/PackageManager(1180): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged
02-23 10:51:50.897: D/PackageManager(1180): generateServicesMap(android.content.SyncAdapter): 4 services unchanged
02-23 10:51:50.929: D/BackupManagerService(1180): Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.problemio flg=0x10000010 (has extras) }
02-23 10:51:51.047: I/AccountTypeManager(1408): Loaded meta-data for 1 account types, 0 accounts in 647ms(wall) 12ms(cpu)
02-23 10:51:51.117: D/PackageManager(1180): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged
02-23 10:51:51.217: D/PackageManager(1180): generateServicesMap(android.content.SyncAdapter): 4 services unchanged
02-23 10:51:51.357: D/BackupManagerService(1180): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.problemio flg=0x10000010 (has extras) }
02-23 10:51:51.357: V/BackupManagerService(1180): updatePackageParticipantsLocked: com.problemio
02-23 10:51:51.697: W/RecognitionManagerService(1180): no available voice recognition services found
02-23 10:51:52.817: I/AccountTypeManager(1408): Loaded meta-data for 1 account types, 0 accounts in 45ms(wall) 15ms(cpu)
02-23 10:51:52.919: D/BackupManagerService(1180): Received broadcast Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.problemio flg=0x10000010 (has extras) }
02-23 10:51:52.940: V/BackupManagerService(1180): updatePackageParticipantsLocked: com.problemio
02-23 10:51:53.977: D/dalvikvm(1180): GC_EXPLICIT freed 604K, 10% free 12042K/13255K, paused 8ms+129ms
02-23 10:51:54.157: D/AndroidRuntime(1670): Shutting down VM
02-23 10:51:54.177: D/dalvikvm(1670): GC_CONCURRENT freed 101K, 78% free 456K/2048K, paused 1ms+1ms
02-23 10:51:54.187: D/jdwp(1670): Got wake-up signal, bailing out of select
02-23 10:51:54.187: D/dalvikvm(1670): Debugger has detached; object registry had 1 entries
02-23 10:51:54.197: I/AndroidRuntime(1670): NOTE: attach of thread 'Binder Thread #3' failed
02-23 10:51:55.077: D/AndroidRuntime(1689): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
02-23 10:51:55.077: D/AndroidRuntime(1689): CheckJNI is ON
02-23 10:51:56.267: D/AndroidRuntime(1689): Calling main entry com.android.commands.am.Am
02-23 10:51:56.317: I/ActivityManager(1180): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.problemio/.ProblemioActivity} from pid 1689
02-23 10:51:56.347: W/WindowManager(1180): Failure taking screenshot for (180x300) to layer 21000
02-23 10:51:56.417: D/AndroidRuntime(1689): Shutting down VM
02-23 10:51:56.447: D/dalvikvm(1699): Not late-enabling CheckJNI (already on)
02-23 10:51:56.447: I/AndroidRuntime(1689): NOTE: attach of thread 'Binder Thread #3' failed
02-23 10:51:56.457: D/dalvikvm(1689): GC_CONCURRENT freed 101K, 77% free 485K/2048K, paused 1ms+3ms
02-23 10:51:56.457: D/jdwp(1689): Got wake-up signal, bailing out of select
02-23 10:51:56.467: D/dalvikvm(1689): Debugger has detached; object registry had 1 entries
02-23 10:51:56.517: I/ActivityManager(1180): Start proc com.problemio for activity com.problemio/.ProblemioActivity: pid=1699 uid=10041 gids={3003}
02-23 10:51:56.977: W/NetworkManagementSocketTagger(1180): setKernelCountSet(10041, 1) failed with errno -2
02-23 10:51:57.087: I/ActivityManager(1180): START {cmp=com.problemio/.LoginActivity} from pid 1699
02-23 10:51:57.606: D/gralloc_goldfish(1699): Emulator without GPU emulation detected.
02-23 10:51:58.047: E/ActivityThread(1435): Failed to find provider info for com.android.inputmethod.latin.dictionarypack
02-23 10:51:58.117: E/BinaryDictionaryGetter(1435): Could not find a dictionary pack
02-23 10:51:58.207: I/ActivityManager(1180): Displayed com.problemio/.LoginActivity: +916ms (total +1s823ms)
02-23 10:51:58.237: I/ActivityManager(1180): Displayed com.problemio/.ProblemioActivity: +1s854ms
02-23 10:51:58.427: W/NetworkManagementSocketTagger(1180): setKernelCountSet(10009, 0) failed with errno -2
02-23 10:51:58.868: E/ActivityThread(1435): Failed to find provider info for com.android.inputmethod.latin.dictionarypack
02-23 10:51:58.886: E/BinaryDictionaryGetter(1435): Could not find a dictionary pack
02-23 10:53:59.657: W/SoundPool(1180): sample 0 not READY
02-23 10:53:59.748: D/PhoneStatusBar(1233): disable: < expand icons alerts ticker system_info BACK HOME recent* CLOCK >
02-23 10:54:00.097: I/ARMAssembler(35): generated scanline__00000077:03515104_00009002_00000000 [127 ipp] (149 ins) at [0x419dea80:0x419decd4] in 2956444 ns
02-23 10:54:00.117: D/PhoneStatusBar(1233): disable: < expand icons alerts ticker system_info back* home* recent clock* >
02-23 10:54:03.086: D/1(1699): Please enter your password
02-23 10:54:03.086: D/1(1699): Plase enter your login email address
02-23 10:54:41.017: A/BatteryStatsImpl(1180): problem reading network stats
02-23 10:54:41.017: A/BatteryStatsImpl(1180): java.lang.IllegalStateException: problem parsing idx 1
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:300)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:250)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.os.BatteryStatsImpl.getNetworkStatsDetailGroupedByUid(BatteryStatsImpl.java:5734)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.os.BatteryStatsImpl.access$100(BatteryStatsImpl.java:76)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.os.BatteryStatsImpl$Uid.computeCurrentTcpBytesReceived(BatteryStatsImpl.java:2457)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.os.BatteryStatsImpl$Uid.getTcpBytesReceived(BatteryStatsImpl.java:2446)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.os.BatteryStatsImpl.writeSummaryToParcel(BatteryStatsImpl.java:5437)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.os.BatteryStatsImpl.writeLocked(BatteryStatsImpl.java:4836)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.os.BatteryStatsImpl.writeAsyncLocked(BatteryStatsImpl.java:4818)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.server.am.ActivityManagerService.updateCpuStatsNow(ActivityManagerService.java:1649)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.server.am.ActivityManagerService$3.run(ActivityManagerService.java:1531)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): Caused by: java.io.FileNotFoundException: /proc/net/xt_qtaguid/stats: open failed: ENOENT (No such file or directory)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at libcore.io.IoBridge.open(IoBridge.java:406)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at java.io.FileInputStream.<init>(FileInputStream.java:78)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:269)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): ... 10 more
02-23 10:54:41.017: A/BatteryStatsImpl(1180): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at libcore.io.Posix.open(Native Method)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at libcore.io.IoBridge.open(IoBridge.java:390)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): ... 12 more
02-23 10:55:09.777: D/dalvikvm(1261): GC_CONCURRENT freed 384K, 6% free 9529K/10119K, paused 8ms+9ms
02-23 10:56:33.198: W/ThrottleService(1180): unable to find stats for iface rmnet0
02-23 11:00:46.967: A/NetworkStats(1180): problem reading network stats
02-23 11:00:46.967: A/NetworkStats(1180): java.lang.IllegalStateException: problem parsing idx 1
02-23 11:00:46.967: A/NetworkStats(1180): at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:300)
02-23 11:00:46.967: A/NetworkStats(1180): at com.android.server.NetworkManagementService.getNetworkStatsUidDetail(NetworkManagementService.java:1282)
02-23 11:00:46.967: A/NetworkStats(1180): at com.android.server.net.NetworkStatsService.performPollLocked(NetworkStatsService.java:831)
02-23 11:00:46.967: A/NetworkStats(1180): at com.android.server.net.NetworkStatsService.performPoll(NetworkStatsService.java:799)
02-23 11:00:46.967: A/NetworkStats(1180): at com.android.server.net.NetworkStatsService.access$100(NetworkStatsService.java:128)
02-23 11:00:46.967: A/NetworkStats(1180): at com.android.server.net.NetworkStatsService$3.onReceive(NetworkStatsService.java:633)
02-23 11:00:46.967: A/NetworkStats(1180): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:728)
02-23 11:00:46.967: A/NetworkStats(1180): at android.os.Handler.handleCallback(Handler.java:605)
02-23 11:00:46.967: A/NetworkStats(1180): at android.os.Handler.dispatchMessage(Handler.java:92)
02-23 11:00:46.967: A/NetworkStats(1180): at android.os.Looper.loop(Looper.java:137)
02-23 11:00:46.967: A/NetworkStats(1180): at android.os.HandlerThread.run(HandlerThread.java:60)
02-23 11:00:46.967: A/NetworkStats(1180): Caused by: java.io.FileNotFoundException: /proc/net/xt_qtaguid/stats: open failed: ENOENT (No such file or directory)
02-23 11:00:46.967: A/NetworkStats(1180): at libcore.io.IoBridge.open(IoBridge.java:406)
02-23 11:00:46.967: A/NetworkStats(1180): at java.io.FileInputStream.<init>(FileInputStream.java:78)
02-23 11:00:46.967: A/NetworkStats(1180): at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:269)
02-23 11:00:46.967: A/NetworkStats(1180): ... 10 more
02-23 11:00:46.967: A/NetworkStats(1180): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
02-23 11:00:46.967: A/NetworkStats(1180): at libcore.io.Posix.open(Native Method)
02-23 11:00:46.967: A/NetworkStats(1180): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
02-23 11:00:46.967: A/NetworkStats(1180): at libcore.io.IoBridge.open(IoBridge.java:390)
02-23 11:00:46.967: A/NetworkStats(1180): ... 12 more
02-23 11:01:00.456: D/dalvikvm(1180): GC_CONCURRENT freed 632K, 10% free 12039K/13255K, paused 10ms+15ms
02-23 11:02:33.617: D/dalvikvm(1261): GC_CONCURRENT freed 384K, 6% free 9529K/10119K, paused 24ms+7ms
02-23 11:06:33.266: W/ThrottleService(1180): unable to find stats for iface rmnet0
我不太确定这意味着什么:)
但是我在我的服务器日志中看到该 url 没有被使用hit,这是重要的部分,这意味着这段代码最终没有向我的身份验证服务器发出请求。知道这里出了什么问题吗?
谢谢!
I am trying to learn how to use the AsyncTask class to authenticate the user whose account is stored on a remote server and database.
I am working from an example and so far I have this code:
package com.problemio;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class LoginActivity extends Activity
{
private TextView textView;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
// Show form for login_email
final EditText loginEmail = (EditText) findViewById(R.id.login_email);
String name = loginEmail.getText().toString();
// Show field for password
final EditText password = (EditText) findViewById(R.id.password);
String text = password.getText().toString();
// Show button for submit
Button submit = (Button)findViewById(R.id.submit);
// Show options for create-profile and forgot-password
submit.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View v)
{
String email = loginEmail.getText().toString();
String pass = password.getText().toString();
sendFeedback(pass, email);
}
});
}
public void sendFeedback(String pass , String email)
{
Log.d( "1" , pass );
Log.d( "1" , email );
// Go to db and check if these r legit
// How do I do that? :)
ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
postParameters.add(new BasicNameValuePair("username", email ));
postParameters.add(new BasicNameValuePair("password", pass ));
}
private class DownloadWebPageTask extends AsyncTask<String, Void, String>
{
@Override
protected String doInBackground(String... urls)
{
Log.d( "Inner class: " , "Doing stuff in background" );
String response = "";
for (String url : urls) {
DefaultHttpClient client = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(url);
try {
HttpResponse execute = client.execute(httpGet);
InputStream content = execute.getEntity().getContent();
BufferedReader buffer = new BufferedReader(
new InputStreamReader(content));
String s = "";
while ((s = buffer.readLine()) != null) {
response += s;
}
} catch (Exception e) {
e.printStackTrace();
}
}
return response;
}
@Override
protected void onPostExecute(String result)
{
textView.setText(result);
}
}
public void readWebpage(View view)
{
DownloadWebPageTask task = new DownloadWebPageTask();
task.execute(new String[] { "http://www.myurl.com" });
}
}
and I get some errors in the LogCat like:
02-23 10:51:45.587: D/AndroidRuntime(1670): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
02-23 10:51:45.587: D/AndroidRuntime(1670): CheckJNI is ON
02-23 10:51:47.037: D/AndroidRuntime(1670): Calling main entry com.android.commands.pm.Pm
02-23 10:51:47.118: W/ActivityManager(1180): No content provider found for permission revoke: file:///data/local/tmp/Problemio.apk
02-23 10:51:47.267: W/ActivityManager(1180): No content provider found for permission revoke: file:///data/local/tmp/Problemio.apk
02-23 10:51:47.467: I/PackageManager(1180): Removing non-system package:com.problemio
02-23 10:51:47.467: I/ActivityManager(1180): Force stopping package com.problemio uid=10041
02-23 10:51:47.467: I/ActivityManager(1180): Killing proc 1648:com.problemio/10041: force stop
02-23 10:51:47.477: W/ActivityManager(1180): Force removing ActivityRecord{4147f5d0 com.problemio/.LoginActivity}: app died, no saved state
02-23 10:51:47.518: I/ActivityManager(1180): Force finishing activity ActivityRecord{413e9e98 com.problemio/.ProblemioActivity}
02-23 10:51:47.587: W/InputDispatcher(1180): channel '4160fcd8 com.problemio/com.problemio.ProblemioActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
02-23 10:51:47.587: E/InputDispatcher(1180): channel '4160fcd8 com.problemio/com.problemio.ProblemioActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
02-23 10:51:47.607: I/WindowManager(1180): WIN DEATH: Window{416096c0 com.problemio/com.problemio.LoginActivity paused=false}
02-23 10:51:47.637: I/WindowManager(1180): WIN DEATH: Window{4160fcd8 com.problemio/com.problemio.ProblemioActivity paused=true}
02-23 10:51:47.637: W/InputDispatcher(1180): Attempted to unregister already unregistered input channel '4160fcd8 com.problemio/com.problemio.ProblemioActivity (server)'
02-23 10:51:47.667: I/WindowManager(1180): WINDOW DIED Window{4160fcd8 com.problemio/com.problemio.ProblemioActivity paused=true}
02-23 10:51:47.707: E/InputDispatcher(1180): Received spurious receive callback for unknown input channel. fd=206, events=0x8
02-23 10:51:48.157: D/dalvikvm(1180): GC_CONCURRENT freed 527K, 9% free 12067K/13255K, paused 10ms+43ms
02-23 10:51:48.587: W/NetworkManagementSocketTagger(1180): setKernelCountSet(10041, 0) failed with errno -2
02-23 10:51:48.587: W/NetworkManagementSocketTagger(1180): setKernelCountSet(10009, 1) failed with errno -2
02-23 10:51:48.598: I/PackageManager(1180): Package com.problemio codePath changed from /data/app/com.problemio-1.apk to /data/app/com.problemio-2.apk; Retaining data and using new
02-23 10:51:48.667: I/PackageManager(1180): Running dexopt on: com.problemio
02-23 10:51:49.247: D/dalvikvm(1681): DexOpt: load 54ms, verify+opt 86ms
02-23 10:51:49.307: W/PackageManager(1180): Code path for pkg : com.problemio changing from /data/app/com.problemio-1.apk to /data/app/com.problemio-2.apk
02-23 10:51:49.317: W/PackageManager(1180): Resource path for pkg : com.problemio changing from /data/app/com.problemio-1.apk to /data/app/com.problemio-2.apk
02-23 10:51:49.327: I/ActivityManager(1180): Force stopping package com.problemio uid=10041
02-23 10:51:49.517: D/PackageManager(1180): New package installed in /data/app/com.problemio-2.apk
02-23 10:51:49.808: I/ActivityManager(1180): Force stopping package com.problemio uid=10041
02-23 10:51:49.997: D/dalvikvm(1275): GC_EXPLICIT freed 235K, 6% free 11344K/12039K, paused 5ms+13ms
02-23 10:51:50.177: D/dalvikvm(1341): GC_EXPLICIT freed 168K, 4% free 9389K/9735K, paused 105ms+9ms
02-23 10:51:50.646: D/dalvikvm(1180): GC_EXPLICIT freed 448K, 10% free 12001K/13255K, paused 83ms+18ms
02-23 10:51:50.728: D/PackageManager(1180): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged
02-23 10:51:50.897: D/PackageManager(1180): generateServicesMap(android.content.SyncAdapter): 4 services unchanged
02-23 10:51:50.929: D/BackupManagerService(1180): Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.problemio flg=0x10000010 (has extras) }
02-23 10:51:51.047: I/AccountTypeManager(1408): Loaded meta-data for 1 account types, 0 accounts in 647ms(wall) 12ms(cpu)
02-23 10:51:51.117: D/PackageManager(1180): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged
02-23 10:51:51.217: D/PackageManager(1180): generateServicesMap(android.content.SyncAdapter): 4 services unchanged
02-23 10:51:51.357: D/BackupManagerService(1180): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.problemio flg=0x10000010 (has extras) }
02-23 10:51:51.357: V/BackupManagerService(1180): updatePackageParticipantsLocked: com.problemio
02-23 10:51:51.697: W/RecognitionManagerService(1180): no available voice recognition services found
02-23 10:51:52.817: I/AccountTypeManager(1408): Loaded meta-data for 1 account types, 0 accounts in 45ms(wall) 15ms(cpu)
02-23 10:51:52.919: D/BackupManagerService(1180): Received broadcast Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.problemio flg=0x10000010 (has extras) }
02-23 10:51:52.940: V/BackupManagerService(1180): updatePackageParticipantsLocked: com.problemio
02-23 10:51:53.977: D/dalvikvm(1180): GC_EXPLICIT freed 604K, 10% free 12042K/13255K, paused 8ms+129ms
02-23 10:51:54.157: D/AndroidRuntime(1670): Shutting down VM
02-23 10:51:54.177: D/dalvikvm(1670): GC_CONCURRENT freed 101K, 78% free 456K/2048K, paused 1ms+1ms
02-23 10:51:54.187: D/jdwp(1670): Got wake-up signal, bailing out of select
02-23 10:51:54.187: D/dalvikvm(1670): Debugger has detached; object registry had 1 entries
02-23 10:51:54.197: I/AndroidRuntime(1670): NOTE: attach of thread 'Binder Thread #3' failed
02-23 10:51:55.077: D/AndroidRuntime(1689): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
02-23 10:51:55.077: D/AndroidRuntime(1689): CheckJNI is ON
02-23 10:51:56.267: D/AndroidRuntime(1689): Calling main entry com.android.commands.am.Am
02-23 10:51:56.317: I/ActivityManager(1180): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.problemio/.ProblemioActivity} from pid 1689
02-23 10:51:56.347: W/WindowManager(1180): Failure taking screenshot for (180x300) to layer 21000
02-23 10:51:56.417: D/AndroidRuntime(1689): Shutting down VM
02-23 10:51:56.447: D/dalvikvm(1699): Not late-enabling CheckJNI (already on)
02-23 10:51:56.447: I/AndroidRuntime(1689): NOTE: attach of thread 'Binder Thread #3' failed
02-23 10:51:56.457: D/dalvikvm(1689): GC_CONCURRENT freed 101K, 77% free 485K/2048K, paused 1ms+3ms
02-23 10:51:56.457: D/jdwp(1689): Got wake-up signal, bailing out of select
02-23 10:51:56.467: D/dalvikvm(1689): Debugger has detached; object registry had 1 entries
02-23 10:51:56.517: I/ActivityManager(1180): Start proc com.problemio for activity com.problemio/.ProblemioActivity: pid=1699 uid=10041 gids={3003}
02-23 10:51:56.977: W/NetworkManagementSocketTagger(1180): setKernelCountSet(10041, 1) failed with errno -2
02-23 10:51:57.087: I/ActivityManager(1180): START {cmp=com.problemio/.LoginActivity} from pid 1699
02-23 10:51:57.606: D/gralloc_goldfish(1699): Emulator without GPU emulation detected.
02-23 10:51:58.047: E/ActivityThread(1435): Failed to find provider info for com.android.inputmethod.latin.dictionarypack
02-23 10:51:58.117: E/BinaryDictionaryGetter(1435): Could not find a dictionary pack
02-23 10:51:58.207: I/ActivityManager(1180): Displayed com.problemio/.LoginActivity: +916ms (total +1s823ms)
02-23 10:51:58.237: I/ActivityManager(1180): Displayed com.problemio/.ProblemioActivity: +1s854ms
02-23 10:51:58.427: W/NetworkManagementSocketTagger(1180): setKernelCountSet(10009, 0) failed with errno -2
02-23 10:51:58.868: E/ActivityThread(1435): Failed to find provider info for com.android.inputmethod.latin.dictionarypack
02-23 10:51:58.886: E/BinaryDictionaryGetter(1435): Could not find a dictionary pack
02-23 10:53:59.657: W/SoundPool(1180): sample 0 not READY
02-23 10:53:59.748: D/PhoneStatusBar(1233): disable: < expand icons alerts ticker system_info BACK HOME recent* CLOCK >
02-23 10:54:00.097: I/ARMAssembler(35): generated scanline__00000077:03515104_00009002_00000000 [127 ipp] (149 ins) at [0x419dea80:0x419decd4] in 2956444 ns
02-23 10:54:00.117: D/PhoneStatusBar(1233): disable: < expand icons alerts ticker system_info back* home* recent clock* >
02-23 10:54:03.086: D/1(1699): Please enter your password
02-23 10:54:03.086: D/1(1699): Plase enter your login email address
02-23 10:54:41.017: A/BatteryStatsImpl(1180): problem reading network stats
02-23 10:54:41.017: A/BatteryStatsImpl(1180): java.lang.IllegalStateException: problem parsing idx 1
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:300)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:250)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.os.BatteryStatsImpl.getNetworkStatsDetailGroupedByUid(BatteryStatsImpl.java:5734)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.os.BatteryStatsImpl.access$100(BatteryStatsImpl.java:76)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.os.BatteryStatsImpl$Uid.computeCurrentTcpBytesReceived(BatteryStatsImpl.java:2457)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.os.BatteryStatsImpl$Uid.getTcpBytesReceived(BatteryStatsImpl.java:2446)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.os.BatteryStatsImpl.writeSummaryToParcel(BatteryStatsImpl.java:5437)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.os.BatteryStatsImpl.writeLocked(BatteryStatsImpl.java:4836)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.os.BatteryStatsImpl.writeAsyncLocked(BatteryStatsImpl.java:4818)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.server.am.ActivityManagerService.updateCpuStatsNow(ActivityManagerService.java:1649)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.server.am.ActivityManagerService$3.run(ActivityManagerService.java:1531)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): Caused by: java.io.FileNotFoundException: /proc/net/xt_qtaguid/stats: open failed: ENOENT (No such file or directory)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at libcore.io.IoBridge.open(IoBridge.java:406)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at java.io.FileInputStream.<init>(FileInputStream.java:78)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:269)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): ... 10 more
02-23 10:54:41.017: A/BatteryStatsImpl(1180): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at libcore.io.Posix.open(Native Method)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): at libcore.io.IoBridge.open(IoBridge.java:390)
02-23 10:54:41.017: A/BatteryStatsImpl(1180): ... 12 more
02-23 10:55:09.777: D/dalvikvm(1261): GC_CONCURRENT freed 384K, 6% free 9529K/10119K, paused 8ms+9ms
02-23 10:56:33.198: W/ThrottleService(1180): unable to find stats for iface rmnet0
02-23 11:00:46.967: A/NetworkStats(1180): problem reading network stats
02-23 11:00:46.967: A/NetworkStats(1180): java.lang.IllegalStateException: problem parsing idx 1
02-23 11:00:46.967: A/NetworkStats(1180): at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:300)
02-23 11:00:46.967: A/NetworkStats(1180): at com.android.server.NetworkManagementService.getNetworkStatsUidDetail(NetworkManagementService.java:1282)
02-23 11:00:46.967: A/NetworkStats(1180): at com.android.server.net.NetworkStatsService.performPollLocked(NetworkStatsService.java:831)
02-23 11:00:46.967: A/NetworkStats(1180): at com.android.server.net.NetworkStatsService.performPoll(NetworkStatsService.java:799)
02-23 11:00:46.967: A/NetworkStats(1180): at com.android.server.net.NetworkStatsService.access$100(NetworkStatsService.java:128)
02-23 11:00:46.967: A/NetworkStats(1180): at com.android.server.net.NetworkStatsService$3.onReceive(NetworkStatsService.java:633)
02-23 11:00:46.967: A/NetworkStats(1180): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:728)
02-23 11:00:46.967: A/NetworkStats(1180): at android.os.Handler.handleCallback(Handler.java:605)
02-23 11:00:46.967: A/NetworkStats(1180): at android.os.Handler.dispatchMessage(Handler.java:92)
02-23 11:00:46.967: A/NetworkStats(1180): at android.os.Looper.loop(Looper.java:137)
02-23 11:00:46.967: A/NetworkStats(1180): at android.os.HandlerThread.run(HandlerThread.java:60)
02-23 11:00:46.967: A/NetworkStats(1180): Caused by: java.io.FileNotFoundException: /proc/net/xt_qtaguid/stats: open failed: ENOENT (No such file or directory)
02-23 11:00:46.967: A/NetworkStats(1180): at libcore.io.IoBridge.open(IoBridge.java:406)
02-23 11:00:46.967: A/NetworkStats(1180): at java.io.FileInputStream.<init>(FileInputStream.java:78)
02-23 11:00:46.967: A/NetworkStats(1180): at com.android.internal.net.NetworkStatsFactory.readNetworkStatsDetail(NetworkStatsFactory.java:269)
02-23 11:00:46.967: A/NetworkStats(1180): ... 10 more
02-23 11:00:46.967: A/NetworkStats(1180): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
02-23 11:00:46.967: A/NetworkStats(1180): at libcore.io.Posix.open(Native Method)
02-23 11:00:46.967: A/NetworkStats(1180): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
02-23 11:00:46.967: A/NetworkStats(1180): at libcore.io.IoBridge.open(IoBridge.java:390)
02-23 11:00:46.967: A/NetworkStats(1180): ... 12 more
02-23 11:01:00.456: D/dalvikvm(1180): GC_CONCURRENT freed 632K, 10% free 12039K/13255K, paused 10ms+15ms
02-23 11:02:33.617: D/dalvikvm(1261): GC_CONCURRENT freed 384K, 6% free 9529K/10119K, paused 24ms+7ms
02-23 11:06:33.266: W/ThrottleService(1180): unable to find stats for iface rmnet0
And I am not too sure what that means at all :)
But I saw in my server logs that the url was not being hit, and that is the important part which means this code did not end up making the request to my auth server. Any idea what is going wrong here?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的
sendFeedback(...)
方法中执行类似以下操作...然后在
AsncTask
的doInBackground(...)
方法中您可以像这样检索它们...您还需要使用
HttpPost
而不是HttpGet
。In your
sendFeedback(...)
method do something like this...Then in your
doInBackground(...)
method of theAsncTask
you can retreive them like so...You'll also need to use an
HttpPost
rather than anHttpGet
.