Java &引用;不幸的是,您的应用程序已停止;在安卓工作室
我正在开发一个基于网络的android项目。在过去的三天里,我的项目中出现了一些错误。请给我一个解决我的问题的办法来完成我的项目。在我的项目中,每当我包含一个Socket java程序时,我都会收到“不幸的是,你的应用程序已经停止了”。。。。 在我的项目中,我使用另一个java类中的Java &引用;不幸的是,您的应用程序已停止;在安卓工作室,java,android,Java,Android,我正在开发一个基于网络的android项目。在过去的三天里,我的项目中出现了一些错误。请给我一个解决我的问题的办法来完成我的项目。在我的项目中,每当我包含一个Socket java程序时,我都会收到“不幸的是,你的应用程序已经停止了”。。。。 在我的项目中,我使用另一个java类中的UDP\u Client.send()调用send()函数。在我的日志中,我发现了一些错误。这里我附上了错误日志 public class UDP_Client { public void S
UDP\u Client.send()
调用send()
函数。在我的日志中,我发现了一些错误。这里我附上了错误日志
public class UDP_Client {
public void Send() throws IOException
{
Socket s = null;
DataOutputStream os = null;
DataInputStream is = null;
try
{
s = new Socket("192.168.0.102", 3000);
os = new DataOutputStream(s.getOutputStream());
is = new DataInputStream(s.getInputStream());
}
catch(UnknownHostException e){
System.err.println("Don't know about host: hostname");
}catch(IOException e){
System.err.println("Couldn't get I/O for the connection to: hostname");
}
if(s!=null){
try {
os.writeBytes("HELLO\n");
} catch (IOException e1) {
e1.printStackTrace();
}
}
else {
mStatusView.setText(formatStatusMessage(R.string.btstatus_connecting_to_fmt, "not connected"));
}
os.close();
is.close();
s.close();
}
}
Logcat错误:
07-23 17:34:25.952966-3505/? W/ReauthClient? Network error calling reauth settings.
07-23 17:34:25.9552930-7535/? D/IPCThreadState? [DN #5] BR_CLEAR_DEATH_NOTIFICATION_DONE cookie 0x60b69298
07-23 17:34:25.96128495-28505/? D/IPCThreadState? [DN #5] BR_CLEAR_DEATH_NOTIFICATION_DONE cookie 0x5d267fc0
07-23 17:34:25.966 28495-29145/? E/KeepSync? IOException
com.google.android.apiary.AuthenticationException: Could not get an auth token
at com.google.android.apiary.GoogleRequestInitializer.getAuthToken(SourceFile:150)
at com.google.android.apiary.GoogleRequestInitializer.intercept(SourceFile:89)
at com.google.android.keep.syncadapter.b$a.intercept(SourceFile:220)
at com.google.api.client.http.HttpRequest.execute(SourceFile:858)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(SourceFile:410)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(SourceFile:343)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(SourceFile:460)
at com.google.android.keep.syncadapter.b.a(SourceFile:194)
at com.google.android.keep.syncadapter.KeepSyncAdapter.a(SourceFile:217)
at com.google.android.keep.syncadapter.KeepSyncAdapter.onPerformSync(SourceFile:147)
at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:254)
Caused by: java.io.IOException: NetworkError
at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
at com.google.android.gms.auth.GoogleAuthUtil.a(Unknown Source)
at com.google.android.gms.auth.GoogleAuthUtil.getTokenWithNotification(Unknown Source)
at com.google.android.apiary.GoogleRequestInitializer.getAuthToken(SourceFile:140)
at com.google.android.apiary.GoogleRequestInitializer.intercept(SourceFile:89)
at com.google.android.keep.syncadapter.b$a.intercept(SourceFile:220)
at com.google.api.client.http.HttpRequest.execute(SourceFile:858)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(SourceFile:410)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(SourceFile:343)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(SourceFile:460)
at com.google.android.keep.syncadapter.b.a(SourceFile:194)
at com.google.android.keep.syncadapter.KeepSyncAdapter.a(SourceFile:217)
at com.google.android.keep.syncadapter.KeepSyncAdapter.onPerformSync(SourceFile:147)
at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:254)
07-23 17:34:25.96628495-29145/? W/KeepSync? Sync result 2
07-23 17:34:25.967529-576/? D/ConnectivityService? getActiveNetworkInfo:null