This is utterly frustrating...Any help is greatly appreciated.
Please don't assume that I haven't referred to previous posts on this issue. I did and tried all the suggestions made in those posts to fix this issue several times, but to no avail, though others have posted it worked for them.
Here is the problem.
I added two jar files that are the implementation of json-rpc2 protocol. They are downloaded from the following location.
http://software.dzhuvinov.com//download.html#download-jsonrpc2client
The library files are:
jsonrpc2-base-1.35.jar jsonrpc2-client-1.14.4.jar
I added them to libs folder and then added those libraries by right clicking on them within the studio. I added the dependencies in build.gradle of my project. I cleaned and built the project. Please note all this time the library references were recognized by the compiler and build was successful. Now comes the problem... The same libraries that were properly recognized during coding and during compilation, WOULD NOT WORK DURING RUN TIME. I get the following No Class Found error. Please save the remaining hair on my head. Thanks.
--------- beginning of crash
com.example.admin.myapplication E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.admin.myapplication, PID: 1877
java.lang.NoClassDefFoundError: com.thetransactioncompany.jsonrpc2.JSONRPC2Request
at com.example.admin.myapplication.MainActivity.accessWebService(MainActivity.java:154)
at com.example.admin.myapplication.MainActivity$1.onClick(MainActivity.java:55)
at android.view.View.performClick(View.java:4756)
at android.view.View$PerformClick.run(View.java:19749)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Below is the content of build.gradle file.
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.admin.myapplication"
minSdkVersion 5
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile files('libs/jsonrpc2-base-1.35.jar')
compile files('libs/jsonrpc2-client-1.14.4.jar')
}