0

我正在尝试使用 ksoap2 库在 Android 应用程序中使用 .NET 服务。我在我的项目中添加了对 ksoap2-android-assembly-2.6.5-jar-with-dependencies jar 的引用。但是当我运行代码时,我得到一个运行时异常

java.lang.NoClassDefFound : org.ksoap2.serialization.SoapObject.

有人可以帮忙吗?这是我的代码。

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    SoapSerializationEnvelope envelope = 
        new SoapSerializationEnvelope(SoapEnvelope.VER11); 
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);


    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

    try {
        androidHttpTransport.call(SOAP_ACTION, envelope);
        SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
        tvTemp.setText("Received :" + resultsRequestSOAP.toString());
    } catch (Exception e) {
        e.printStackTrace();
    }
4

1 回答 1

0

I solved the problem using the link provided by the first commentator on the question. I am leaving the answer here just in case another programmer faces the same problem and comes across my question.

The solution to this problem is to create a folder named "libs" in the project directory and copying all the external jar files there.

For further explanation, one can refer to this link. http://tools.android.com/recent/dealingwithdependenciesinandroidprojects

于 2012-06-07T09:00:39.307 回答