mit-dig / punya

Punya Framework powered by MIT App Inventor Technology
http://punya.mit.edu/
Apache License 2.0
13 stars 39 forks source link

Error in LocationProbeSensor (seems like conflicting dependencies) #49

Open william-vw opened 3 years ago

william-vw commented 3 years ago

Describe the bug

Getting the following error when dragging a LocationProbeSensor onto the screen:

java.lang.NoSuchMethodError: No direct method (Lcom/google/gson/internal/ConstructorConstructor;Lcom/google/gson/FieldNamingStrategy;Lcom/google/gson/internal/Excluder;)V in class Lcom/google/gson/internal/bind/ReflectiveTypeAdapterFactory; or its super classes (declaration of 'com.google.gson.internal.bind.ReflectiveTypeAdapterFactory' appears in /data/app/~~cF5gEuahOyoqw4HVEvaB_w==/edu.mit.appinventor.punya.aicompanion3-V4hOJ9dUWuUw_fDdj9WEFg==/base.apk!classes2.dex) 05-28 09:21:23.969 19223 19223 E AndroidRuntime: at edu.mit.media.funf.config.ConfigurableTypeAdapterFactory.(ConfigurableTypeAdapterFactory.java:48) 05-28 09:21:23.969 19223 19223 E AndroidRuntime: at edu.mit.media.funf.FunfManager.getProbeFactory(FunfManager.java:410) 05-28 09:21:23.969 19223 19223 E AndroidRuntime: at edu.mit.media.funf.FunfManager.getGsonBuilder(FunfManager.java:361) 05-28 09:21:23.969 19223 19223 E AndroidRuntime: at edu.mit.media.funf.FunfManager.getGsonBuilder(FunfManager.java:352) 05-28 09:21:23.969 19223 19223 E AndroidRuntime: at edu.mit.media.funf.FunfManager.getGson(FunfManager.java:381) 05-28 09:21:23.969 19223 19223 E AndroidRuntime: at edu.mit.media.funf.FunfManager.onCreate(FunfManager.java:129) 05-28 09:21:23.969 19223 19223 E AndroidRuntime: at android.app.ActivityThread.handleCreateService(ActivityThread.java:4192) 05-28 09:21:23.969 19223 19223 E AndroidRuntime: at android.app.ActivityThread.access$1500(ActivityThread.java:237) 05-28 09:21:23.969 19223 19223 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1932) 05-28 09:21:23.969 19223 19223 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106) 05-28 09:21:23.969 19223 19223 E AndroidRuntime: at android.os.Looper.loop(Looper.java:223) 05-28 09:21:23.969 19223 19223 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7656) 05-28 09:21:23.969 19223 19223 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 05-28 09:21:23.969 19223 19223 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 05-28 09:21:23.969 19223 19223 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

It seems that there are conflicting dependencies - in particular keyczar includes com.google.json classes that lack the registerTypeAdapterFactory.

Affects

LocationProbeSensor

Expected behavior

To not get an error message, I suppose.

Steps to reproduce

Drag and drop a LocationProbeSensor onto the screen in the public Punya instance, and connect to the MIT Punya Companion.

william-vw commented 3 years ago

Note that keyczar is deprecated and the developers recommend using tink: https://github.com/google/keyczar

Tink has an explicit dependency on gson so it shouldn't cause the same issues.