diff --git a/README.md b/README.md index e03a72c..ec546a6 100644 --- a/README.md +++ b/README.md @@ -69,17 +69,20 @@ A breakdown of the files inside: `libdotnet.so` is ~1.9MB, and `libSkiaSharp.so` is ~8.5MB! +If we reduce this to a "Hello World" example: + +* `hello.apk` is ~561 KB! +* `libdotnet.so` (uncompressed) is ~1.1 MB + ## "Hello World" Example +See the [HelloWorld](https://github.com/jonathanpeppers/Android-NativeAOT/tree/HelloWorld) branch. + I had this managed code: ```csharp [UnmanagedCallersOnly(EntryPoint = "ManagedAdd")] -public static int ManagedAdd(int x, int y) -{ - Console.WriteLine($"ManagedAdd({x}, {y})"); - return x + y; -} +public static int ManagedAdd(int x, int y) => x + y; ``` I created a C++ Android project using NativeActivity, and I called the managed @@ -91,13 +94,14 @@ extern "C" int ManagedAdd(int x, int y); // in native-lib.cpp int result = ManagedAdd(1, 2); -__android_log_print (ANDROID_LOG_INFO, "Native", "ManagedAdd(1, 2) returned: %i", result); +__android_log_print (ANDROID_LOG_INFO, TAG, "ManagedAdd(1, 2) returned: %i", result); ``` Results in the message: ```log -01-29 10:41:04.363 11016 11042 I Native : ManagedAdd(1, 2) returned: 3 +01-31 11:42:44.545 28239 28259 I NATIVE : Entering android_main +01-31 11:42:44.550 28239 28259 I NATIVE : ManagedAdd(1, 2) returned: 3 ``` See [DotNet/README.md](DotNet/README.md) on how to build `libdotnet.so`.