package com.illa.adrdp.one;import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.TextView;
public class AdrdpOneSix extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tx = new TextView(this) ;
String endPoint = "http://localhost:8888/test/services/SayHello" ;
Service service = new Service() ;
Call call = (Call)service.createCall() ;
call.setTargetEndpointAddress(new java.net.URL(endPoint)) ;
call.setOperationName("getName") ;
String str = null ;
try {
str = (String)call.invoke(new Object[]{"高建华"}) ;
}catch(Exception e) {
e.printStackTrace() ;
}
tx.setText(str) ;
setContentView(tx); }
}红色部分有problem,- The method invoke(Object[]) from the type Call refers to the missing type RemoteException
- The type java.rmi.RemoteException cannot be resolved. It is indirectly referenced from required .class files新学android 这样的问题是为什么呢
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.TextView;
public class AdrdpOneSix extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tx = new TextView(this) ;
String endPoint = "http://localhost:8888/test/services/SayHello" ;
Service service = new Service() ;
Call call = (Call)service.createCall() ;
call.setTargetEndpointAddress(new java.net.URL(endPoint)) ;
call.setOperationName("getName") ;
String str = null ;
try {
str = (String)call.invoke(new Object[]{"高建华"}) ;
}catch(Exception e) {
e.printStackTrace() ;
}
tx.setText(str) ;
setContentView(tx); }
}红色部分有problem,- The method invoke(Object[]) from the type Call refers to the missing type RemoteException
- The type java.rmi.RemoteException cannot be resolved. It is indirectly referenced from required .class files新学android 这样的问题是为什么呢
但是怎么才能把第三方的jar打包进android 中呢?
右键工程,
Build path,
java build path,选择libraries
在右边的按钮中点击“Add Library”
选择“User library”,点击“下一步”
点击“User librarys”按钮
在出现的界面中点击“New..”按钮
在弹出的界面中随便起一个名字,点击“确定”
点击“Add jars”按钮选择第三方jar包,点击“确定”完成操作。
这样的话该jar包会被一起打包到apk中,问题也就解决了!
右键工程,
Build path,
java build path,选择libraries
在右边的按钮中点击“Add Library”
选择“User library”,点击“下一步”
点击“User librarys”按钮
在出现的界面中点击“New..”按钮
在弹出的界面中随便起一个名字,点击“确定”
点击“Add jars”按钮选择第三方jar包,点击“确定”完成操作。
这样的话该jar包会被一起打包到apk中,问题也就解决了!四楼是正确的,我也遇到了楼主一样的问题,按照四楼的方法解决了。