I just added ksoap2 (actually it is ksoap2-android-assembly-3.4.0-jar-with-dependencies.jar) to app/libs folder. Also I have used the Project Structure window to add ksoap2 to the Dependencies tab.
the Build.Gradle has this section
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.android.support:support-v4:22.0.0' compile files('libs/ksoap2-android-assembly-3.4.0-jar-with-dependencies.jar') }
Anyway I cannot import ksoap2 like
import org.ksoap.*;
Any clue?
Advertisement
Answer
At first, You should remove ksoap in Project Structure and do the steps bellow.
I have same problem and here is the way which work for me.
1st: Make folder libs in app/libs.
2nd: Copy ksoap.jar to this folder.
3rd: right click to Jar file and chose add as library.
From now, you can import ksoap2 to your code normally.
You can create an object from ksoap2, the library will be imported automatically.
Ex: type SoapObject tempResponse = null
import org.ksoap2.SoapObject; import org.ksoap2.serialization.PropertyInfo; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapPrimitive; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE;
P/s: You should use ksoap library latest is 3.6.0, should not use 3.4.0 😉