You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hope to implement "full aot" to remove libmonodroid_bundle_app.so.
It can reduce the size of the software when we do not need to dynamically generate the code.
Hope to implement "full aot" to remove libmonodroid_bundle_app.so.
That doesn't make any sense at all, as it intermixes two separate things.
(Aside: supporting "Full AOT", while possible, is explicitly not a goal, because it will very likely cause all existing apps to break, as it doesn't support any JIT use. We support "Hybrid AOT", which supports using the Full AOT backend+native libraries, while continuing to support a JIT, for System.Reflection.Emit/etc. use. Plus, Xamarin.Android itself still requires a JIT. Even if Xamarin.Android didn't require it, we have no way of knowing what existing apps require runtime codegen. Removing the JIT is Not A Thing we are considering.)
libmonodroid_bundle_app.so only contains assemblies, zip-compressed. It's a way to avoid the assemblies/ directory within the .apk.
"Full AOT"/Hybrid AOT generates a native library (.so) for each assembly. The assembly is still required to exist, somewhere, so that System.Reflection can work. (The assemblies can be IL-stripped with Hybrid AOT, but they must still exist!)
Finally, Hybrid AOT results in huge native libraries. You almost certainly will not get smaller apps from it. You will get faster apps from it. (The classic size/speed tradeoff.)
You are able to use both mkbundle ("Bundle assemblies into native code"/libmonodroid_bundle_app.so) and Hybrid AOT together and separately. They do not interact with each other in any meaningful way.
@jonpryor U've mentioned that assemblies can be IL-stripped. From security perspective it is a great thing. Right now it is matter of few hours for a smart guy from the street that knows what deflate is and has .APK, to get real IL.
Is there possibility that you guys make that stripping part of XA build pipeline ? Will be happy to become your beta tester.
I found enable linker can solve the problem. But it will fail in runtime.
@jonpryor, thanks for the feedback but I'm using some 3rd party libraries that doesn't allow me to link system.core file which results that kind of runtime error.
I wrote a custom msbuild task that removes unwanted .so files and cil-strip .dll files if their counterpart is in the lib folder as .so file before the "_Sign" step. All I want is a partial AOT. I don't need system.core to be striped because I don't want this file to be native as .so. When I run the final apk on the device, it gives "Could not load assembly AAAA during startup registration" error although the file is there in the assemblies folder as striped and there is a libaot- counterpart in the lib folder. Aot mode is normal. Is there a way to do what I want?
Activity
jonpryor commentedon Dec 11, 2017
That doesn't make any sense at all, as it intermixes two separate things.
(Aside: supporting "Full AOT", while possible, is explicitly not a goal, because it will very likely cause all existing apps to break, as it doesn't support any JIT use. We support "Hybrid AOT", which supports using the Full AOT backend+native libraries, while continuing to support a JIT, for
System.Reflection.Emit/etc. use. Plus, Xamarin.Android itself still requires a JIT. Even if Xamarin.Android didn't require it, we have no way of knowing what existing apps require runtime codegen. Removing the JIT is Not A Thing we are considering.)libmonodroid_bundle_app.soonly contains assemblies, zip-compressed. It's a way to avoid theassemblies/directory within the.apk."Full AOT"/Hybrid AOT generates a native library (
.so) for each assembly. The assembly is still required to exist, somewhere, so thatSystem.Reflectioncan work. (The assemblies can be IL-stripped with Hybrid AOT, but they must still exist!)Finally, Hybrid AOT results in huge native libraries. You almost certainly will not get smaller apps from it. You will get faster apps from it. (The classic size/speed tradeoff.)
You are able to use both mkbundle ("Bundle assemblies into native code"/
libmonodroid_bundle_app.so) and Hybrid AOT together and separately. They do not interact with each other in any meaningful way.Belorus commentedon Jan 11, 2018
@jonpryor U've mentioned that assemblies can be IL-stripped. From security perspective it is a great thing. Right now it is matter of few hours for a smart guy from the street that knows what deflate is and has .APK, to get real IL.
Is there possibility that you guys make that stripping part of XA build pipeline ? Will be happy to become your beta tester.
jonpryor commentedon Jan 11, 2018
@Belorus: That should already be possible:
$(AndroidAotMode)=Hybrid$(AotAssemblies)=TrueThis should cause
cil-strip.exeto be run, which will remove method body IL from the assemblies.As with iOS, assemblies are still needed, but the IL method bodies are not.
bulente commentedon Jan 12, 2018
I tried to build my project with
AndroidAotMode=Hybridand get this error when archiving:yinyue200 commentedon Jan 13, 2018
@bulente I found enable linker can solve the problem. But it will fail in runtime.
Unhandled Exception:
@jonpryor
bulente commentedon Jan 13, 2018
@jonpryor, thanks for the feedback but I'm using some 3rd party libraries that doesn't allow me to link system.core file which results that kind of runtime error.
bulente commentedon Jan 13, 2018
I wrote a custom msbuild task that removes unwanted .so files and cil-strip .dll files if their counterpart is in the lib folder as .so file before the "_Sign" step. All I want is a partial AOT. I don't need system.core to be striped because I don't want this file to be native as .so. When I run the final apk on the device, it gives "Could not load assembly AAAA during startup registration" error although the file is there in the assemblies folder as striped and there is a libaot- counterpart in the lib folder. Aot mode is normal. Is there a way to do what I want?
[Xamarin.Android.Build.Tasks] Fast Deployment v2.0 (#4690)