java.lang.NoSuchMethodError: No virtual method getBoolean(Ljava/lang/Object;J)Z in class Lsun/misc/Unsafe; or its super classes (declaration of 'sun.misc.Unsafe' appears in /system/framework/core-libart.jar)

713 views
Skip to first unread message

Steven Pierre

unread,
Mar 27, 2023, 4:43:56 PM3/27/23
to Protocol Buffers
Running into this error ```java.lang.NoSuchMethodError: No virtual method getBoolean(Ljava/lang/Object;J)Z in class Lsun/misc/Unsafe; or its super classes (declaration of 'sun.misc.Unsafe' appears in /system/framework/core-libart.jar)
at com.google.protobuf.UnsafeUtil$JvmMemoryAccessor.getBoolean(UnsafeUtil.java:666)
at com.google.protobuf.UnsafeUtil.getBoolean(UnsafeUtil.java:144)
at com.google.protobuf.MessageSchema.isFieldPresent(MessageSchema.java:5967)
at com.google.protobuf.MessageSchema.getSerializedSizeProto3(MessageSchema.java:2089)
at com.google.protobuf.MessageSchema.getSerializedSize(MessageSchema.java:1464)
at com.google.protobuf.GeneratedMessageLite.computeSerializedSize(GeneratedMessageLite.java:390)
at com.google.protobuf.GeneratedMessageLite.getSerializedSize(GeneratedMessageLite.java:373)
at com.google.protobuf.CodedOutputStream.computeMessageSizeNoTag(CodedOutputStream.java:927)
at com.google.protobuf.CodedOutputStream.computeMessageSize(CodedOutputStream.java:715)
at com.google.protobuf.SchemaUtil.computeSizeMessage(SchemaUtil.java:675)
at com.google.protobuf.MessageSchema.getSerializedSizeProto2(MessageSchema.java:1551)
at com.google.protobuf.MessageSchema.getSerializedSize(MessageSchema.java:1464)
at com.google.protobuf.GeneratedMessageLite.computeSerializedSize(GeneratedMessageLite.java:387)
at com.google.protobuf.GeneratedMessageLite.getSerializedSize(GeneratedMessageLite.java:373)
at com.google.protobuf.GeneratedMessageLite.getSerializedSize(GeneratedMessageLite.java:382)
at com.google.protobuf.AbstractMessageLite.toByteArray(AbstractMessageLite.java:72)
at com.google.android.apps.youtube.app.common.devicecapabilities.XenoEffectTextureProcessorTest.setEffect_returnsSuccessfulFuture(XenoEffectTextureProcessorTest.java:101)```
when adding a test for protobuf parsing in this cl https://critique.corp.google.com/cl/519762270. Here is the full link to the error: https://fusion2.corp.google.com/invocations/ab032a75-9dac-424e-ae64-764d376fc00d/targets/%2F%2Fjavatests%2Fcom%2Fgoogle%2Fandroid%2Fapps%2Fyoutube%2Fapp%2Fcommon%2Fdevicecapabilities:XenoEffectTextureProcessorTest/tests .

Looking online it says this most commonly occur on a protobuf version mismatch but that is not the case here when I run blaze query. Am I missing an import or is this a potential bad interaction with the jni in the test?

Scott Beeker

unread,
Mar 28, 2023, 11:42:26 AM3/28/23
to Protocol Buffers
Check for a mismatch in your gradle file and android sdk version locally.

add  
multiDexEnabled true implementation 'org.tensorflow:tensorflow-lite-gpu:2.2.0'

both to your gradle.build 


If all else fails downgrade your android sdk. 
Reply all
Reply to author
Forward
0 new messages