Forum Xamarin.Android

Bundle into native code Release build never works

chetszotchetszot PLMember ✭✭

Hello

I am developing a Xamarin.Forms app and I want to create Android APK file with lowest possibility for potential people to reverse-engineer my app. Therefore I try to use Bundle Into native code feature, which actually never works.

On my Release build I have set following:

  • Enable Multi-Dex
  • Linking SDK assemblies only
  • selected ABIs: armeabi-v7 and x86

All other checkboxes are not checked.

Each time I try to build with Bundle into native code enabled, I got mkbundle.exe crashed (the Windows app crash popup appears) and on Visual Studio console I see Conversion from assembly to native code failed. Exit code -532462766.

What should I do in order to get it finally working?

Many thanks in advance

Answers

  • cwphillicwphilli USMember ✭✭✭

    Please change your MSBuild output to Detailed and post your full build output

  • chetszotchetszot PLMember ✭✭
    edited May 2017

    Hello

    Many thanks for your response. I cannot post the full build report as it contains some app internals, but mkbundle part is as follows:

    '[mkbundle stderr] ERROR: Duplicate assembly name Programs_C'. BothD:\Programs_C' and D:\Programs_C' use same assembly name. [mkbundle stderr] [mkbundle stderr] Wyjątek nieobsłużony: System.Exception: Zgłoszono wyjątek typu 'System.Exception'. [mkbundle stderr] w MakeBundle.Error(String msg, Object[] args) [mkbundle stderr] w MakeBundle.QueueAssembly(List1 files, String codebase)
    [mkbundle stderr] w MakeBundle.Main(String[] args)
    [mkbundle stderr]
    Conversion from assembly to native code failed. Exit code -532462766
    Done building project "Camtronome.Droid.csproj" -- FAILED.
    Build FAILED.'

    Above the mkbundle there were mostly copying various dlls logs, with no errors and between some of them there were:

    'Building target "_CollectConfigFiles" partially, because some output files are out of date with respect to their input files.
    Skipping target "_CopyConfigFiles" because it has no outputs.
    Building target "_CopyIntermediateAssemblies" partially, because some output files are out of date with respect to their input files.'

    I hope this is enough. Do you have any clues?

    Thank you,
    Regards

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭
    edited February 2018

    @chetszot - Did you find a solution to this? I want to bundle into native code, and I'm not seeing any effect when checking this option. We're also using multi-dex.

    So far I'm only looking at debug builds (I assume it is meant to work for debug builds).

    Edit - just realised you're getting a crash on build. I'm not getting a crash, but don't seem to see any effect of checking this option. I'm building on a Mac which is of course different too!

  • chetszotchetszot PLMember ✭✭

    Hello

    I haven't fixed the issue and none of VS updates from 15.4 through 15.5.6 resolved the issue. However, I have some findings after doing some research.

    When I first posted the problem here, I was trying to build the app using 1st-gen Core i5-760. This PC is still unable to build with Bundle into native code option enabled. Both updates and VS/Xamarin reinstalls never helped.

    Because the problem was not resolved and I needed this option to be set, as a workaround I used different PC with Core i5-6600 CPU in order to make a test build which surprisingly worked well. PC with that CPU had no problems and Bundle into native code option always worked.

    Now I have brand-new i7 8700k as my development machine and Bundle into native code option also works here pretty well.

    My thought is that the problem posted above is because of some CPU-level instruction set missing on older CPUs. 1st gen i5-760 have never ever succeed with such build. Both i5-6600 and i7-8700k on the other hand have never ever had any problems. All PCs had the same VS versions. Both i5 CPUs ran Windows 8.1 Pro, i7 was on Windows 10 Pro.

    I think you could try to build on a newer CPU.

Sign In or Register to comment.