导入 org.ksoap2.transport.HttpTransportSE 无法解析
我从 此链接:
将下载的 .jar 文件导入 Eclipse 中的 Android 项目后,我仅在第一个导入行 (HttpTransportSE) 中遇到导入错误。我搜索过,但没有其他人遇到/发布过这个问题。怎么会这样?谢谢!
import org.ksoap2.transport.HttpTransportSE; //ERROR:The import org.ksoap2.transport.HttpTransportSE cannot be resolved
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
I downloaded ksoap2 from this link:
after importing the downloaded .jar file into an Android project in Eclipse, I got import error for only the first import line (HttpTransportSE). I searched but nobody else has had/posted this issue. How could this be? thanks!
import org.ksoap2.transport.HttpTransportSE; //ERROR:The import org.ksoap2.transport.HttpTransportSE cannot be resolved
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您已经下载了 J2ME 包,但 HttpTransportSE 是 J2SE jar 文件的一部分。
ksoap2-j2se-full-2.1.2.jar
不应该在 Android 上正常工作吗?You've downloaded the J2ME package, but HttpTransportSE is part of the J2SE jar file.
Shouldn't
ksoap2-j2se-full-2.1.2.jar
work just fine with Android?使用这个专门针对 android 的库,它对我有用(Ksoap2-j2se-full 也不适合我)
http://code.google.com/p/ksoap2-android/
Use this library its specific for android and it worked for me (Ksoap2-j2se-full didn't work for me as well)
http://code.google.com/p/ksoap2-android/
您应该使用 ksoap2-android-assemble-2.6.3-jar-with-dependency.jar 文件。
访问 http://code.google.com/p/ksoap2- android/wiki/HowToUse?tm=2
You should use ksoap2-android-assembly-2.6.3-jar-with-dependencies.jar file.
visit http://code.google.com/p/ksoap2-android/wiki/HowToUse?tm=2
您必须将其添加到库中。 (我使用的是Android Studio)
右键单击Android Studio中的库文件(显示在project_name / app / libs /下 - >会有一个选项“添加为库”,
选择
然后会出现一个对话框,您必须在其中选择模块
就是这样! :)
You will Have to add it to Library. (I am using Android Studio)
Right click the library file in the Android Studio(shown under project_name/app/libs/ -> there will an option "Add As Library",
select that
Then A dialogue box will appear where you will have to Select the Module
Thats IT! :)