Estimote / Android-Fleet-Management-SDK

Estimote Fleet Management SDK for Android
https://developer.estimote.com
MIT License
836 stars 451 forks source link

Analytics not working #154

Closed shawnmurphy22 closed 7 years ago

shawnmurphy22 commented 8 years ago

When trying to set up analytics, we get the following error:

com.estimote.sdk.cloud.internal.AnalyticsManager$2.failure:253

 Unable to obtain owned devices for Analytics
                                                                   com.estimote.sdk.exception.EstimoteServerException: InternalEstimoteApi.getBeacons: HTTP method annotation is required (e.g., @GET, @POST, etc.).
                                                                       at com.estimote.sdk.cloud.internal.InternalEstimoteCloud$6.failure(InternalEstimoteCloud.java:347)
                                                                       at com.estimote.sdk.repackaged.retrofit_v1_9_0.retrofit.CallbackRunnable$2.run(CallbackRunnable.java:53)
                                                                       at android.os.Handler.handleCallback(Handler.java:739)
                                                                       at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                       at android.os.Looper.loop(Looper.java:158)
                                                                       at android.app.ActivityThread.main(ActivityThread.java:7229)
                                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
                                                                    Caused by: com.estimote.sdk.repackaged.retrofit_v1_9_0.retrofit.RetrofitError: InternalEstimoteApi.getBeacons: HTTP method annotation is required (e.g., @GET, @POST, etc.).
                                                                       at com.estimote.sdk.repackaged.retrofit_v1_9_0.retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:399)
                                                                       at com.estimote.sdk.repackaged.retrofit_v1_9_0.retrofit.RestAdapter$RestHandler.access$000(RestAdapter.java:219)
                                                                       at com.estimote.sdk.repackaged.retrofit_v1_9_0.retrofit.RestAdapter$RestHandler$1.obtainResponse(RestAdapter.java:277)
                                                                       at com.estimote.sdk.repackaged.retrofit_v1_9_0.retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
                                                                       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                                       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                                       at com.estimote.sdk.repackaged.retrofit_v1_9_0.retrofit.Platform$Android$2$1.run(Platform.java:134)
                                                                       at java.lang.Thread.run(Thread.java:818)
                                                                    Caused by: java.lang.IllegalArgumentException: InternalEstimoteApi.getBeacons: HTTP method annotation is required (e.g., @GET, @POST, etc.).
                                                                       at com.estimote.sdk.repackaged.retrofit_v1_9_0.retrofit.RestMethodInfo.methodError(RestMethodInfo.java:106)
                                                                       at com.estimote.sdk.repackaged.retrofit_v1_9_0.retrofit.RestMethodInfo.parseMethodAnnotations(RestMethodInfo.java:178)
                                                                       at com.estimote.sdk.repackaged.retrofit_v1_9_0.retrofit.RestMethodInfo.init(RestMethodInfo.java:116)
                                                                       at com.estimote.sdk.repackaged.retrofit_v1_9_0.retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:293)
                                                                       at com.estimote.sdk.repackaged.retrofit_v1_9_0.retrofit.RestAdapter$RestHandler.access$000(RestAdapter.java:219) 
                                                                       at com.estimote.sdk.repackaged.retrofit_v1_9_0.retrofit.RestAdapter$RestHandler$1.obtainResponse(RestAdapter.java:277) 
                                                                       at com.estimote.sdk.repackaged.retrofit_v1_9_0.retrofit.CallbackRunnable.run(CallbackRunnable.java:42) 
                                                                       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
                                                                       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
                                                                       at com.estimote.sdk.repackaged.retrofit_v1_9_0.retrofit.Platform$Android$2$1.run(Platform.java:134) 
                                                                       at java.lang.Thread.run(Thread.java:818)

We initialize the SDK in our application file as follows:

EstimoteSDK.initialize(this, "APP-ID", "APP-TOKEN");       
EstimoteSDK.enableMonitoringAnalytics(true);
  EstimoteSDK.enableRangingAnalytics(true);
pawelDylag commented 8 years ago

Hello @Murph22 !

Thanks for reporting that! This kind of error occurs, when annotations are stripped by ProGuard. You can try disabling it and check if that helps. If you really need to use it, you can try adding this to your proguard-rules file:

-keepattributes *Annotation*

Here is a related issue: https://github.com/square/retrofit/issues/435 Tell me if that helps and have a nice day :)

shawnmurphy22 commented 8 years ago

Hey @pawelDylag,

Thanks for the quick response. Since we were already using retrofit in our app we already had that line in our proguard-rules file as follows:

-keepattributes SourceFile,LineNumberTable,*Annotation*,Signature

Is there any other fix you can think of that can resolve this issue?

Luxilia commented 8 years ago

I'm also having problems with EstimoteCloud and retrofit, and I have proguard disabled. Get "No retrofit annotation for parameter 1" and "Only one http request allowed, found GET and GET" when trying to use the cloud service.

Arun-intelipower commented 7 years ago

Hi I'm getting the same Error my stack trace is as follows

com.estimote.sdk.cloud.a.a$2.a:250 Unable to obtain owned devices for Analytics com.estimote.sdk.a.b: e.a: HTTP method annotation is required (e.g., @GET, @POST, etc.). at com.estimote.sdk.cloud.a.f$4.a(SourceFile:391) at com.estimote.sdk.repackaged.e.a.b$2.run(SourceFile:53) at android.os.Handler.handleCallback(Handler.java:746) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5443) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) Caused by: com.estimote.sdk.repackaged.e.a.o: e.a: HTTP method annotation is required (e.g., @GET, @POST, etc.). at com.estimote.sdk.repackaged.e.a.m$d.a(SourceFile:399) at com.estimote.sdk.repackaged.e.a.m$d.a(SourceFile:219) at com.estimote.sdk.repackaged.e.a.m$d$1.a(SourceFile:277) at com.estimote.sdk.repackaged.e.a.b.run(SourceFile:42) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at com.estimote.sdk.repackaged.e.a.g$a$2$1.run(SourceFile:134) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.IllegalArgumentException: e.a: HTTP method annotation is required (e.g., @GET, @POST, etc.). at com.estimote.sdk.repackaged.e.a.n.a(SourceFile:106) at com.estimote.sdk.repackaged.e.a.n.b(SourceFile:178) at com.estimote.sdk.repackaged.e.a.n.a(SourceFile:116) at com.estimote.sdk.repackaged.e.a.m$d.a(SourceFile:291) at com.estimote.sdk.repackaged.e.a.m$d.a(SourceFile:219)  at com.estimote.sdk.repackaged.e.a.m$d$1.a(SourceFile:277)  at com.estimote.sdk.repackaged.e.a.b.run(SourceFile:42)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)  at com.estimote.sdk.repackaged.e.a.g$a$2$1.run(SourceFile:134)  at java.lang.Thread.run(Thread.java:818) 

I'm facing the same problem using it on Android Marshmallow and Nougat, Samsung Galaxy S6 , MotoG3 and Google Pixel. I was already using Retrofit so i have all the pro-guard rules as suggested above but it still gives me the same error , Can some one tell me if they have found a solution for it as I'm in a crunch to release apk as per clients request as soon as possible .

Thanks .

pawelDylag commented 7 years ago

Hello @Arun-intelipower, @Murph22

We recently released version 1.0.0 of our SDK (See migration guide). Could you confirm if this problem still occurs for you? If so, we will investigate it further and add some fixups :)