Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CognitiveServices.Speech.core.so assembly can't be loaded - xamarin Android 12 Emulator x86_64 - API 31 #1457

Closed
pasha-o opened this issue Apr 7, 2022 · 10 comments
Assignees
Labels
accepted Issue moved to product team backlog. Will be closed when addressed. enhancement New feature or request

Comments

@pasha-o
Copy link

pasha-o commented Apr 7, 2022

Describe the bug
@glharper , @jgardner04 Targeting new android API 31 on a fresh emulator on Pixel 5, API 31 with X86-64 processor, the DLL won't load.
libMicrosoft.CognitiveServices.Speech.core.so assembly: type: member:(null)

Expected behavior
dll should load

Version of the Cognitive Services Speech SDK
Microsoft.CognitiveServices.Speech Version 1.20.0 for Xamarin Forms

Platform, Operating System, and Programming Language

  • OS: Android API 31
  • Hardware - x86-64
  • Programming language: C#

Additional context
There is no way to change the processor to only X86 in the Android SDK manager for Pixel 5 API 31

@dargilco
Copy link
Member

dargilco commented Apr 8, 2022

Adding @jhakulin

@jhakulin
Copy link

@pasha-o Thanks for the report. We will investigate and let you know what we can find out.

@jhakulin
Copy link

jhakulin commented Apr 12, 2022

@pasha-o The problem is that currently Speech SDK NuGet for Xamarin do not contain x86_64 binary for Android, but only x86. If Android Studio do not support x86 emulation for API 31 (Android 12) and onwards, this is a gap, which we can fix in the future releases. For now, are you able to test your app using earlier Android API version and x86 emulator?

Alternatively if you want to do some tailoring, it could be possible to take x86_64 native library from Speech SDK .aar package from Maven repository in Azure blob storage (see https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/speech-sdk?tabs=android%2Cubuntu%2Cios-xcode%2Cmac-xcode%2Candroid-studio) and place the x86_64 binary there into your Xamarin application.

Here is the direct link to .aar package https://csspeechstorage.blob.core.windows.net/maven/com/microsoft/cognitiveservices/speech/client-sdk/1.20.0/client-sdk-1.20.0.aar. If you unzip that (e.g. by using 7zip), you can find x86_64 binaries under client-sdk-1.20.0\jni\x86_64 directory.
You can try to import those into your Xamarin application for Android.

@jhakulin jhakulin added the accepted Issue moved to product team backlog. Will be closed when addressed. label Apr 12, 2022
@jhakulin
Copy link

Internal task 4179271

@pasha-o
Copy link
Author

pasha-o commented Apr 12, 2022

hi, @jhakulin thanks for the note. according to android link, the apps must support the 64-bit architecture. Do you happen to know when you'd have support for the x86_64 binary as I feel android will move away from 32-bit?

thanks for the direct link, I found the binaries - do you know the steps of importing them into the android project? should I uninstall the nuget?

@jhakulin
Copy link

jhakulin commented Apr 12, 2022

@pasha-o Thanks, we do support 64-bit ARM architecture in the NuGet. We will add x86_64 support for Android NuGet for Xamarin as well in the next release (currently x86_64 is available in .aar package). Are you targeting x86_64 Xamarin to emulator only or to actual Android device which is using Intel's x64?

Below quick instructions on how to build Xamarin project with x86_64 architecture included.

  1. Uninstall NuGet from Xamarin project
  2. Add reference to Microsoft.CognitiveServices.Speech.csharp.dll to Xamarin main project (which you can find from NuGet lib\monoandroid directory when unzipped)
  3. Add AndroidNativeLibrary (which you can find from .aar client-sdk-1.20.0\jni\x86_64 directory) to Android project (Mouse right click -> Add -> Existing item) and set the BuildAction to AndroidNativeLibrary
    image

See also following which might help.
https://docs.microsoft.com/en-us/xamarin/android/platform/native-libraries

@pasha-o
Copy link
Author

pasha-o commented Apr 14, 2022

Thanks, @jhakulin - your explanation helped. looking forward to the next release. Is there a timeline for the next release?

@jhakulin
Copy link

@pasha-o x86_64 support in NuGet for Android would go to 1.22.0 Speech SDK release, where ETA is end of May 2022.

@pankopon pankopon added the enhancement New feature or request label Apr 19, 2022
@pankopon
Copy link
Contributor

Internal work item ref. 4179271.

@jhakulin
Copy link

Support for x86_64 Android emulation has been added to 1.22.0 Speech SDK release for Xamarin. Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Issue moved to product team backlog. Will be closed when addressed. enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants