Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
3
Question by Hotshot10101 · Apr 23, 2019 at 07:46 PM · androidpluginjnibytearray

2019 Unity Android Exception

I make a plugin for Unity to support Bluetooth Low Energy on Android and iOS.

Version 2019 of Unity now installs its own copy of the Android SDK and NDK, which is awesome.

The thing that I found that surprised me, however, is that now one of my native method calls is throwing and exception. Specifically when I cal setValue on the GATT object to write a characteristic.

In my current version of my plugin I pass a normal C# byte array to my write characteristic method and pass it directly to the setValue call on the Android API.

This now throws an exception where it didn't before.

Here is the exception:

 04-23 22:54:49.474 26615 26634 W Unity   : AndroidJNIHelper.GetSignature: using Byte parameters is obsolete, use SByte parameters instead
 
 04-23 22:54:49.474 26615 26634 W Unity   :
 
 04-23 22:54:49.474 26615 26634 W Unity   : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 48)
 
 04-23 22:54:49.474 26615 26634 W Unity   :
 
 04-23 22:54:49.481 26615 26634 W Unity   : AndroidJNIHelper: converting Byte array is obsolete, use SByte array instead
 
 04-23 22:54:49.481 26615 26634 W Unity   :
 
 04-23 22:54:49.481 26615 26634 W Unity   : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 48)
 
 04-23 22:54:49.481 26615 26634 W Unity   :

I did some searches on sbyte and Android and byte and couldn't really find anything related to the native code. What I did find was a lot of information about sbyte and C#.

From the error and my searching it looks like something has changed as it relates to being able to pass a C# byte array to Android native java code. There appears to be some helper in Unity in this AndroidJNIHelper namespace.

The solution to my issue was to not pass in a C# byte array from my C# code to the Android code, but to pass an sbyte array instead.

I would like to better understand where this change occurred. Did something change in Unity or the Android SDK or both?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

104 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Sending String of Data through JNI to Android Plugin 1 Answer

Getting byte[] or ByteBuffer[] from native Java 1 Answer

Using AndroidJavaObject.CallStatic to retrieve a return value 0 Answers

[Android] Call .jar function on render thread using JNI 0 Answers

How can I browse files on Android outside of the Unity App folder? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges