mono / Embeddinator-4000

Tools to turn .NET libraries into native libraries that can be consumed on Android, iOS, Mac, Linux and other platforms.
MIT License
758 stars 95 forks source link

Can't locate SDK/NDK #707

Closed BadMiscuit closed 6 years ago

BadMiscuit commented 6 years ago

Steps to Reproduce

  1. Install from nuget
  2. C:\Users\username\.nuget\packages\embeddinator-4000\0.4.0\tools\Embeddinator-4000.exe "C:\Users\username\source\repos\hello_from_csharp\hello_from_csharp\bin\Debug\hello_from_csharp.dll" --gen=Java --platform=Android --outdir=".\hello_from_csharp" -c -verbose

Expected Behavior

Generate .aar

Actual Behavior

System.ArgumentNullException: Value can't be null. Parameter name: path1

Environment

Windows 10 64-bits
Visual Studio Community 2017

Embeddinator-4000 v0.1 (0.4: 7664197)
Mono Last version (32-bits)
Android SDK installed
Android NDK r17c
Java JDK 1.8.0

Build Logs

Parsing assemblies...
    Parsed 'hello_from_csharp.dll'
Processing assemblies...
``
Generating binding code...
    Generated: hello_from_csharp.h
    Generated: hello_from_csharp.c
    Generated: Mono.Android.h
    Generated: Mono.Android.c
    Generated: Java.Interop.h
    Generated: Java.Interop.c
    Generated: mscorlib.h
    Generated: mscorlib.c
    Generated: c-support.c
    Generated: c-support.h
    Generated: embeddinator.h
    Generated: glib.c
    Generated: glib.h
    Generated: mono-support.c
    Generated: mono-support.h
    Generated: mono_embeddinator.c
    Generated: mono_embeddinator.h
Compiling binding code...
      Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidSdkDirectory not found.
      Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidNdkDirectory not found.
      Key HKCU\SOFTWARE\Novell\Mono for Android\JavaSdkDirectory not found.
    Looking for Android SDK...
      Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidSdkDirectory not found.
      Key HKLM\SOFTWARE\Novell\Mono for Android\AndroidSdkDirectory not found.
      Key HKCU\SOFTWARE\Xamarin\MonoAndroid\PrivateAndroidSdkPath not found.
      Key HKCU\SOFTWARE\Android SDK Tools\Path not found.
      Key HKLM\SOFTWARE\Android SDK Tools\Path not found.
    Looking for Android NDK...
      Key HKCU\SOFTWARE\Novell\Mono for Android\AndroidNdkDirectory not found.
      Key HKLM\SOFTWARE\Novell\Mono for Android\AndroidNdkDirectory not found.
      Key HKCU\SOFTWARE\Novell\Mono for Android\JavaSdkDirectory not found.
      Key HKLM\SOFTWARE\Novell\Mono for Android\JavaSdkDirectory not found.
    Looking for Java 6 SDK...
      Key HKLM\SOFTWARE\JavaSoft\Java Development Kit\CurrentVersion found.
      Key HKLM\SOFTWARE\JavaSoft\Java Development Kit\1.8\JavaHome found:
    Path contains jarsigner.exe in \bin (C:\Program Files (x86)\Java\jdk1.8.0_181).

Exception non gérée: System.ArgumentNullException: La valeur ne peut pas être null.
Nom du paramètre: path1
   … System.IO.Path.Combine(String path1, String path2)
   … Embeddinator.Driver.CompileNDK(IEnumerable`1 files)
   … Embeddinator.Driver.CompileNativeCode(IEnumerable`1 files)
   … Embeddinator.Driver.CompileCode()
   … Embeddinator.Driver.Run()
   … Embeddinator.CLI.Main(String[] args)

Example Project (If Possible)

Sample from documentation

BadMiscuit commented 6 years ago

Can I manually add the registry keys? And if so, which keys to add?

rolfbjarne commented 6 years ago

This looks like a duplicate of #663. Also check this: https://github.com/mono/Embeddinator-4000/issues/693#issuecomment-416881474

BadMiscuit commented 6 years ago

I've manually downloaded the Android SDK 15c and changed the path in the Visual Studio > Xamarin settings but it doesn't change anything.

EDIT: I fixed it manually adding registry keys HKEY_CURRENT_USER\Software\Novell\Mono for Android and registry values AndroidNdkDirectory=pathtondkdirectory, AndroidSdkDirectory=pathtosdkdirectory and JavaSdkDirectory=pathtoJavaSdkdirectory