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 /
  • Help Room /
avatar image
0
Question by tomc128 · Sep 10, 2019 at 09:14 PM · androiderroril2cpplibrarylogcat

Trying to use an external library in my Android project, but managed code stripping causes an error.

Hi, I'm trying to use the SSH.Net library in my Android project, however I'm running into an error. Specifially, MissingMethodException: Default constructor not found for type Renci.SshNet.Security.KeyExchangeDiffieHellmanGroupExchangeSha256.

I've determined the problem is to do with 'Managed Code Stripping' in project settings, because if I switch to Mono and disable the option, the library works fine. I've read about link.xml files to disable stripping for particular code, however the contents I have at the minute do not help and the error persists:

 <linker>
     <assembly fullname="Renci.*" preserve="all">
         <namespace fullname="Renci.SshNet" preserve="all"/>
         <namespace fullname="Renci.SshNet.*" preserve="all"/>
         <type fullname="Renci.SshNet" preserve="all"/>
         <type fullname="Renci.SshNet.*" preserve="all"/>
     </assembly>
     <assembly fullname="Renci.SshNet.*" preserve="all"/>
 
     <assembly fullname="Renci.SshNet.Sftp" preserve="all"/>
     <assembly fullname="Renci.SshNet.Messages" preserve="all"/>
     <assembly fullname="Renci.SshNet.Compression" preserve="all"/>
 
     <assembly fullname="Renci.SshNet.Security.*" preserve="all">
         <namespace fullname="Renci.SshNet.Security" preserve="all"/>
         <namespace fullname="Renci.SshNet.Security.*" preserve="all"/>
         <type fullname="Renci.SshNet.Security" preserve="all"/>
         <type fullname="Renci.SshNet.Security.*" preserve="all"/>
         <type fullname="Renci.SshNet.Security.KeyExchangeDiffieHellmanGroupExchangeSha256" preserve="all"/>
     </assembly>
 </linker>

(you may be able to tell I just wrote as many random lines as I could hoping it would fix the problem)

So my question is, what would a link.xml file need to contain to stop the SSH.Net library code from being stripped? And unfortunately, I cannot use Mono as it does not offer arm64 builds.

Edit: I've also found out by googling the error code (-2146233069), that the class is accessed dynamically so I believe this requires the link.xml file to change (reading the documenttion.)

Thanks.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by JoshPeterson · Sep 11, 2019 at 11:57 AM

Try to use the assembly element with the preserve="all" attribute for each managed assembly by full name without wildcards. That should prevent any of the assemblies listed from being stripped, as if managed code stripping is disabled for this assemblies. There is no need to preserve specific name spaces or types within those assemblies then.

Comment
Add comment · Show 2 · Share
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
avatar image tomc128 · Sep 11, 2019 at 05:56 PM 0
Share

Alright, I'll try that now. However, I've just found out that the constructor is called dynamically, which reading the documentation, seems to change how the link.xml should look.

avatar image gbk_ · Jun 08, 2020 at 03:03 PM 0
Share

did u get any solution for this? got exactly same error

avatar image
1

Answer by gbk_ · Jun 08, 2020 at 03:20 PM

Found solution -, thanks to @JoshPeterson

link.xml works fine, but without astercs

 <?xml version="1.0" encoding="UTF-8"?>
 <linker>
     <assembly fullname="Renci" preserve="all">
         <namespace fullname="Renci.SshNet" preserve="all" />
         <type fullname="Renci.SshNet" preserve="all" />
     </assembly>
     <assembly fullname="Renci.SshNet" preserve="all" />
     <assembly fullname="Renci.SshNet.Sftp" preserve="all" />
     <assembly fullname="Renci.SshNet.Messages" preserve="all" />
     <assembly fullname="Renci.SshNet.Compression" preserve="all" />
     <assembly fullname="Renci.SshNet.Security" preserve="all">
         <namespace fullname="Renci.SshNet.Security" preserve="all" />
         <type fullname="Renci.SshNet.Security" preserve="all" />
         <type fullname="Renci.SshNet.Security.KeyExchangeDiffieHellmanGroupExchangeSha256" preserve="all" />
     </assembly>
 </linker>

Comment
Add comment · Show 1 · Share
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
avatar image tomc128 · Jun 08, 2020 at 05:59 PM 0
Share

That's good to know! I ended up not using the library because using an SSH library for a level browser was a dumb idea and switched to using a PHP web server ins$$anonymous$$d, which didn't require any external libraries.

avatar image
0

Answer by masterchop · Jul 21, 2021 at 12:51 AM

I tried the XML on MagicLeap but the errror persist. how to fix it please i would really appreciate the help.

Comment
Add comment · Share
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

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

336 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 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 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 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

il2cpp.exe didn't catch exception: System.IO.IOException: Access to the path '{path}' is denied. 0 Answers

IL2CPP Android build with custom static libraries linked with GNU STL static library 0 Answers

Adding .NET STANDARD DLL to unity 0 Answers

How to fix (Gamename) has stopped error? Here is the logcat file. 1 Answer

il2cpp/build/il2cpp.exe did not run properly! 5 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