当前位置:编程学习 > JAVA >>

android 开发wenservice问题(java.rmi.RemoteException cannot be resolved)

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 这样的问题是为什么呢 --------------------编程问答-------------------- 给楼主顶一个~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~哈哈 --------------------编程问答-------------------- 正在学习ANDROID,共同学习啊 --------------------编程问答-------------------- 我把JRE System Library导入后没有编译错误了,可是在Android虚拟机运行时会提示AndroidRuntime 错误,找不到org.apache.axis.client.Service这个class.

我觉得可能没把org.apache.axis.client这个包一起打包到apk中,
但是怎么才能把第三方的jar打包进android 中呢? --------------------编程问答-------------------- android中正确导入第三方jar包:
右键工程,
Build path,
java build path,选择libraries
在右边的按钮中点击“Add Library”
选择“User library”,点击“下一步”
点击“User librarys”按钮
在出现的界面中点击“New..”按钮
在弹出的界面中随便起一个名字,点击“确定”
     点击“Add jars”按钮选择第三方jar包,点击“确定”完成操作。
这样的话该jar包会被一起打包到apk中,问题也就解决了!
--------------------编程问答-------------------- 楼主解决了没,我也遇到这个问题了,但如果不是Android工程就编译通过,如果解决了,请分享一下 --------------------编程问答-------------------- 4L正解。。。 --------------------编程问答-------------------- 我也遇到同样的问题呀,哪位高手指点一下 --------------------编程问答--------------------  org.apache.axis 这个包是干什么的  --------------------编程问答-------------------- 狗屁、都没解决 --------------------编程问答-------------------- android中正确导入第三方jar包:
右键工程,
Build path,
java build path,选择libraries
在右边的按钮中点击“Add Library”
选择“User library”,点击“下一步”
点击“User librarys”按钮
在出现的界面中点击“New..”按钮
在弹出的界面中随便起一个名字,点击“确定”
     点击“Add jars”按钮选择第三方jar包,点击“确定”完成操作。
这样的话该jar包会被一起打包到apk中,问题也就解决了!

四楼是正确的,我也遇到了楼主一样的问题,按照四楼的方法解决了。 --------------------编程问答-------------------- 按照四楼的做了,运行的时候遇到了这个问题




怎么破??
补充:Java ,  Java SE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,