0

I'm trying to implement the sample android app provided here.

I've installed all the dependencies as directed, but when I run the code on an actual phone, the error messages suggests (I think!) that the method setCoookieStore() doesn't exist and that's leading to problems down the road. Is this actually a problem with AsyncHttpClient or is this something which should be done in the parent class? How can I resolve it?

I've tried googling around quite a bit, but most results don't seem relevant and quite often are over my head (Android development beginner...). This seems like the closest thing I could find, but I'm not sure if it's right or how to implement it if it is: Using Cookies across Activities when using HttpClient.

Thank you for your help!


This is the overall series of error message
04-29 05:58:24.386 6867-6867/? E/Zygote: MountEmulatedStorage()
04-29 05:58:24.386 6867-6867/? E/Zygote: v2
04-29 05:58:24.386 6867-6867/? E/Zygote: accessInfo : 0
04-29 05:58:24.386 6867-6867/? E/SELinux: [DEBUG] get_category: variable seinfo: default sensitivity: NULL, cateogry: NULL
04-29 05:58:25.066 6867-6867/com.empatica.empalinksample E/EMPA_C: Loaded
04-29 05:58:25.086 6867-6867/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 Process: com.empatica.empalinksample, PID: 6867
                                                 java.lang.NoSuchMethodError: No virtual method setCookieStore(Lorg/apache/http/client/CookieStore;)V in class Lcom/loopj/android/http/AsyncHttpClient; or its super classes (declaration of 'com.loopj.android.http.AsyncHttpClient' appears in /data/app/com.empatica.empalinksample-2/base.apk)
                                                     at com.empatica.empalink.EmpaDeviceManager.<init>(EmpaDeviceManager.java:180)
                                                     at com.empatica.empalink.EmpaDeviceManager.<init>(EmpaDeviceManager.java:166)
                                                     at com.empatica.sample.MainActivity.onCreate(MainActivity.java:64)
                                                     at android.app.Activity.performCreate(Activity.java:6550)
                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120)
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3108)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3263)
                                                     at android.app.ActivityThread.access$1000(ActivityThread.java:197)
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1687)
                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                     at android.os.Looper.loop(Looper.java:145)
                                                     at android.app.ActivityThread.main(ActivityThread.java:6897)
                                                     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:1404)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Community
  • 1
  • 1
Afflatus
  • 2,302
  • 5
  • 25
  • 40

1 Answers1

0

Apparently I needed to add "useLibrary 'org.apache.http.legacy'" to my app's build.gradle file and make sure the compileSdkVersion and buildToolsVersion were pointing to 23 (instead of 21 which they were before).

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.1'
    useLibrary 'org.apache.http.legacy'
....
Afflatus
  • 2,302
  • 5
  • 25
  • 40