Skip to content

Commit

Permalink
Merge branch 'main' into HelloWorld
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanpeppers committed Jan 31, 2024
2 parents 6fa47a6 + 0eb5515 commit 0fb6d40
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
14 changes: 13 additions & 1 deletion DotNet/libdotnet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,26 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<InvariantGlobalization>true</InvariantGlobalization>
<PublishAot>true</PublishAot>
<PublishAotUsingRuntimePack>true</PublishAotUsingRuntimePack>
<RuntimeIdentifier Condition=" '$(RuntimeIdentifier)' == '' ">linux-bionic-arm64</RuntimeIdentifier>
<!-- SkiaSharp nightly feed -->
<RestoreAdditionalProjectSources>https://aka.ms/skiasharp-eap/index.json</RestoreAdditionalProjectSources>
</PropertyGroup>

<!-- Trimmer switches -->
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<!-- From Android workload: https://github.com/xamarin/xamarin-android/blob/80ee320ed0bb245768ba436b76f9309aca18abc3/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets#L95-L110 -->
<InvariantGlobalization>true</InvariantGlobalization>
<UseSystemResourceKeys>true</UseSystemResourceKeys>
<NullabilityInfoContextSupport>false</NullabilityInfoContextSupport>
<_AggressiveAttributeTrimming>true</_AggressiveAttributeTrimming>
<!-- From SmolSharp: https://github.com/ascpixi/smolsharp/blob/54a4aeb6e8f6cdd64d049862dee611301082e71b/src/SmolSharp.props#L48-L57 -->
<IlcDisableReflection>true</IlcDisableReflection>
<StackTraceSupport>false</StackTraceSupport>
<OptimizationPreference>Size</OptimizationPreference>
</PropertyGroup>

<ItemGroup>
<!-- https://github.com/exelix11/SysDVR/blob/master/Client/Client.csproj -->
<!-- Android needs a proper soname property or it will refuse to load the library -->
Expand Down
Binary file modified Native/app/src/main/libs/arm64-v8a/libdotnet.so
Binary file not shown.
Binary file modified Native/app/src/main/libs/arm64-v8a/libdotnet.so.dbg
Binary file not shown.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The C# side is a:

## App Size

The release `.apk` file of the SkiaSharp sample is ~4,528kb.
The release `.apk` file of the SkiaSharp sample is ~4.26 MB

A breakdown of the files inside:

Expand All @@ -41,7 +41,7 @@ A breakdown of the files inside:
1981-01-01 01:01:02 ..... 56 52 META-INF\com\android\build\gradle\app-metadata.properties
1981-01-01 01:01:02 ..... 1524 753 classes.dex
1981-01-01 01:01:02 ..... 8525024 3733033 lib\arm64-v8a\libSkiaSharp.so
1981-01-01 01:01:02 ..... 1971400 846961 lib\arm64-v8a\libdotnet.so
1981-01-01 01:01:02 ..... 1070792 473191 lib\arm64-v8a\libdotnet.so
1981-01-01 01:01:02 ..... 19504 6869 lib\arm64-v8a\libnativeaot.so
1981-01-01 01:01:02 ..... 2376 867 AndroidManifest.xml
1981-01-01 01:01:02 ..... 7778 7778 res\-6.webp
Expand All @@ -60,19 +60,19 @@ A breakdown of the files inside:
1981-01-01 01:01:02 ..... 3918 3918 res\u5.webp
1981-01-01 01:01:02 ..... 1772 1772 res\yw.webp
1981-01-01 01:01:02 ..... 2036 2036 resources.arsc
1981-01-01 01:01:02 ..... 2085 1127 META-INF\CERT.SF
1981-01-01 01:01:02 ..... 1167 1017 META-INF\CERT.RSA
1981-01-01 01:01:02 ..... 2011 1050 META-INF\MANIFEST.MF
1981-01-01 01:01:02 ..... 2085 1122 META-INF\CERT.SF
1981-01-01 01:01:02 ..... 1167 1021 META-INF\CERT.RSA
1981-01-01 01:01:02 ..... 2011 1046 META-INF\MANIFEST.MF
------------------- ----- ------------ ------------ ------------------------
1981-01-01 01:01:02 10569629 4629574 25 files
1981-01-01 01:01:02 9669021 4255799 25 files
```

`libdotnet.so` is ~1.9MB, and `libSkiaSharp.so` is ~8.5MB!
`libdotnet.so` is ~1.07 MB, 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.apk` is ~430 KB!
* `libdotnet.so` (uncompressed) is ~821 KB!

## "Hello World" Example

Expand Down

0 comments on commit 0fb6d40

Please sign in to comment.