Error local variable type mismatch, in Xamarin.Android

不羁的心 提交于 2019-12-13 04:27:26

问题


I am trying to build a solution in Xamarin with an android library that I imported.

The library come from a manufacturer called bbpos.

I have the following error message :

Error com.android.dx.cf.code.SimException: local variable type mismatch: attempt to set or access a value of type java.lang.String using a local variable of type byte[]. This is symptomatic of .class transformation tools that ignore local variable information.

I think it comes from the library but i dont know from where exactly. Is there a way to know where is the problem ?


回答1:


In case it my help someone else i have finally found the solution.

It turns out the compiler was the problem.

I went to the Xamarin.Android Properties, then went to the Android Options tab. In the Dex compiler field I selected d8.




回答2:


It's quite likely that the library you received isn't built correctly. If you remove the library and the build goes through normally, the problem is definitely there. The thing is, I haven't seen this problem in years and it's quite surprising to see now.

Just to be sure, are you talking about a jar library, not a dll? The (likely) root cause of the problem is explained well in other posts here and here. What you should do to resolve your issue is to try two things:

  1. Build your application with ProGuard enabled.
  2. If that doesn't work, run the library itself through ProGuard as suggested by one of the posts I linked to.


来源:https://stackoverflow.com/questions/58344368/error-local-variable-type-mismatch-in-xamarin-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!