Create Package in XS

NicWiseNicWise NZMember, Insider, Beta mod
edited February 2013 in Xamarin.Android

Just trying to make an APK so I can try out the new TestFlight Android stuff.

Do a build (works). Do Project - Create Android Package. Dialog pops up, but the build also starts in parallel behind, and fails:

Target _BuildApkBundle:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: error : Error executing task MakeBundleNativeCodeExternal: Required property 'AndroidNdkDirectory' not set.
    Task "MakeBundleNativeCodeExternal" execution -- FAILED
    Done building target "_BuildApkBundle" in project "/Users/nic/code/git/educa-ios/mono/EducaAndroid/EducaAndroid.csproj".-- FAILED

I just downloaded the NDK ('cos XS said it wasn't there, now it does). Restarted and did a clean then build. Build works.

I thought it would go:

  • I select menu item
  • It asks for the location / name. I hit ok
  • It starts a build and packages

steps 2 and 3 are in parallel - I dont think it did that before.

The build + package always fails:

Target _BuildApkBundle:
        Assemblies: 16
        SupportedAbis: armeabi-v7a
        AutoDeps: False
        [mkbundle] /usr/bin/mkbundle --nomain -c -o obj/Release/bundles/armeabi-v7a/temp.c -oo obj/Release/bundles/armeabi-v7a/assemblies.o obj/Release/android/assets/EducaAndroid.dll obj/Release/android/assets/EducaApi.MonoDroid.dll obj/Release/android/assets/BigTed.Utils.MonoDroid.dll obj/Release/android/assets/ServiceStack.Text.dll obj/Release/android/assets/RestSharp.MonoDroid.dll obj/Release/android/assets/ActionBarSherlock.dll obj/Release/android/assets/Xamarin.Mobile.dll obj/Release/android/assets/shrunk/mscorlib.dll obj/Release/android/assets/shrunk/Mono.Android.dll obj/Release/android/assets/shrunk/System.Core.dll obj/Release/android/assets/shrunk/System.dll obj/Release/android/assets/shrunk/Mono.Security.dll obj/Release/android/assets/shrunk/System.Xml.dll obj/Release/android/assets/shrunk/System.Runtime.Serialization.dll obj/Release/android/assets/shrunk/System.Xml.Linq.dll obj/Release/android/assets/shrunk/Mono.Android.Support.v4.dll
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: error : Conversion from assembly to native code failed. Exit code 1
    Task "MakeBundleNativeCodeExternal" execution -- FAILED
    Done building target "_BuildApkBundle" in project "/Users/nic/code/git/educa-ios/mono/EducaAndroid/EducaAndroid.csproj".-- FAILED

Done building project "/Users/nic/code/git/educa-ios/mono/EducaAndroid/EducaAndroid.csproj".-- FAILED

Build FAILED.
Errors:

/Users/nic/code/git/educa-ios/mono/EducaAndroid/EducaAndroid.csproj (SignAndroidPackage) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets (_BuildApkBundle target) ->

    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: error : Conversion from assembly to native code failed. Exit code 1

     0 Warning(s)
     1 Error(s)

Any ideas whats going on? Exit code 1 sounds like a license check, but I think I'm all up to date! I even tried reinstalling Xam.Droid, and got the same error :(

Runs fine on the device if I just build and run.

Hay-alp!

Posts

  • NicWiseNicWise NZMember, Insider, Beta mod

    It appears to be an issue with Xamarin.Mobile - I have the latest, but if I open it in the Assembly Browser, I see

    Can't load: Mono.Android Version=0.0.0.0, Culture=neutral, PublicKey=84e....

    So it's looking for the 4.6 Mono.Android, which is good. If I load up the Mono.Android that I have in the project, or view it in the Edit References screen, it does NOT show the PK, just Version=4.0.3.0, Culture=neutral

    Mono.Android.Support.v4 has the signature tho.

    Reinstall time?

  • NicWiseNicWise NZMember, Insider, Beta mod

    Nope, that wasn't the issue. I can add X.Mobile to a blank project and it works. It appears to come down to this command:

    /usr/bin/mkbundle --nomain -c -o obj/Release/bundles/armeabi/temp.c -oo obj/Release/bundles/armeabi/assemblies.o obj/Release/android/assets/EducaAndroid.dll obj/Release/android/assets/EducaApi.MonoDroid.dll obj/Release/android/assets/BigTed.Utils.MonoDroid.dll obj/Release/android/assets/ServiceStack.Text.dll obj/Release/android/assets/RestSharp.MonoDroid.dll obj/Release/android/assets/ActionBarSherlock.dll obj/Release/android/assets/Xamarin.Mobile.dll obj/Release/android/assets/mscorlib.dll obj/Release/android/assets/Mono.Android.dll obj/Release/android/assets/System.Core.dll obj/Release/android/assets/System.dll obj/Release/android/assets/Mono.Security.dll obj/Release/android/assets/System.Xml.dll obj/Release/android/assets/System.Runtime.Serialization.dll obj/Release/android/assets/System.Xml.Linq.dll obj/Release/android/assets/Mono.Android.Support.v4.dll
    

    this fails in the IDE:

    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: error : Conversion from assembly to native code failed. Exit code 1
        Task "MakeBundleNativeCodeExternal" execution -- FAILED
        Done building target "_BuildApkBundle" in project "/Users/nic/code/git/educa/mono/EducaAndroid/EducaAndroid.csproj".-- FAILED
    

    but works on the command line:

    hypermania:EducaAndroid nic$ /usr/bin/mkbundle --nomain -c -o obj/Release/bundles/armeabi/temp.c -oo obj/Release/bundles/armeabi/assemblies.o obj/Release/android/assets/EducaAndroid.dll obj/Release/android/assets/EducaApi.MonoDroid.dll obj/Release/android/assets/BigTed.Utils.MonoDroid.dll obj/Release/android/assets/ServiceStack.Text.dll obj/Release/android/assets/RestSharp.MonoDroid.dll obj/Release/android/assets/ActionBarSherlock.dll obj/Release/android/assets/Xamarin.Mobile.dll obj/Release/android/assets/mscorlib.dll obj/Release/android/assets/Mono.Android.dll obj/Release/android/assets/System.Core.dll obj/Release/android/assets/System.dll obj/Release/android/assets/Mono.Security.dll obj/Release/android/assets/System.Xml.dll obj/Release/android/assets/System.Runtime.Serialization.dll obj/Release/android/assets/System.Xml.Linq.dll obj/Release/android/assets/Mono.Android.Support.v4.dll
    OS is: Darwin
    Sources: 16 Auto-dependencies: False
       embedding: /Users/nic/code/git/educa/mono/EducaAndroid/obj/Release/android/assets/EducaAndroid.dll
       embedding: /Users/nic/code/git/educa/mono/EducaAndroid/obj/Release/android/assets/EducaApi.MonoDroid.dll
       embedding: /Users/nic/code/git/educa/mono/EducaAndroid/obj/Release/android/assets/BigTed.Utils.MonoDroid.dll
       embedding: /Users/nic/code/git/educa/mono/EducaAndroid/obj/Release/android/assets/ServiceStack.Text.dll
       embedding: /Users/nic/code/git/educa/mono/EducaAndroid/obj/Release/android/assets/RestSharp.MonoDroid.dll
       embedding: /Users/nic/code/git/educa/mono/EducaAndroid/obj/Release/android/assets/ActionBarSherlock.dll
       embedding: /Users/nic/code/git/educa/mono/EducaAndroid/obj/Release/android/assets/Xamarin.Mobile.dll
       embedding: /Library/Frameworks/Mono.framework/Versions/2.10.11/lib/mono/4.0/mscorlib.dll
       embedding: /Users/nic/code/git/educa/mono/EducaAndroid/obj/Release/android/assets/Mono.Android.dll
       embedding: /Users/nic/code/git/educa/mono/EducaAndroid/obj/Release/android/assets/System.Core.dll
       embedding: /Users/nic/code/git/educa/mono/EducaAndroid/obj/Release/android/assets/System.dll
       embedding: /Users/nic/code/git/educa/mono/EducaAndroid/obj/Release/android/assets/Mono.Security.dll
       embedding: /Users/nic/code/git/educa/mono/EducaAndroid/obj/Release/android/assets/System.Xml.dll
       embedding: /Users/nic/code/git/educa/mono/EducaAndroid/obj/Release/android/assets/System.Runtime.Serialization.dll
       embedding: /Users/nic/code/git/educa/mono/EducaAndroid/obj/Release/android/assets/System.Xml.Linq.dll
       embedding: /Users/nic/code/git/educa/mono/EducaAndroid/obj/Release/android/assets/Mono.Android.Support.v4.dll
    Compiling:
    as -o obj/Release/bundles/armeabi/assemblies.o temp.s 
    hypermania:EducaAndroid nic$ ls
    

    Anyone got any ideas? Or where to look? @jonp? :)

  • NicWiseNicWise NZMember, Insider, Beta mod

    AND we have a winner: turn off "Bundle assemblies into native code (release only)".

    Turn it off, and it starts working.

    but why?

  • JonathanPryorJonathanPryor USXamarin Team Xamurai

    but why?

    Because we broke mkbundle support. Sorry.

  • NicWiseNicWise NZMember, Insider, Beta mod

    @jonp ah! that makes sense! :) I think @atsushi_eno has a fix, or can repro it at least....

    yay! I can release to TestFlightBeta now!

  • AtsushiEnomotoAtsushiEnomoto JPMember, Xamarin Team Xamurai

    @nicwise, I could only reproduce the issue so far. And sadly your manual invocation of mkbundle is not correct - it uses Mac host so it won't work on Android.
    Actually I also hopefully have some fix at hand and verifying, but will have to wait for another release. Sorry for inconvenience.

  • NicWiseNicWise NZMember, Insider, Beta mod

    @eno - no problem - I jumped the gun in saying thanks for the fix, more to say thanks than to expect a quick fix :)

    Either way, turning off that switch means I can make an APK, upload it to testflight, and my customer is testing it out.

    Happy :)

    Thanks!

  • nicwise, I am having a similar problem with Xamarin.Mobile but I can't find where the "Bundle Assemblies into native code" option is. Any chance you could help me find where it is at?

    Thank you in advance :)

  • NicWiseNicWise NZMember, Insider, Beta mod

    @MacK Sure. Open the properties of your main Android project (right click -> properties). Go into the Build -> Android Build pane, and it's on there.

    you'll need to do it for each configuration (debug, release etc) as they are separate.

  • Thanks nicwise!

  • LeighBowersLeighBowers GBMember

    I'm still experiencing this issue with the latest release of Xamarin.Android and Xamarin Studio.

    Am I ok to publish an app to Google Play with the "Bundle assemblies into native code (release only)" option disabled?

  • NicWiseNicWise NZMember, Insider, Beta mod

    @MilkyJoe possibly, it hasn't been fixed yet :( or it isn't in stable yet.

  • LeighBowersLeighBowers GBMember

    Thanks Nic.

    So has no one been able to submit apps to Google Play since this was broken?

    My client wants me to submit their app asap.

  • NicWiseNicWise NZMember, Insider, Beta mod

    yeah, you can submit I think. Just turn off "Bundle assemblies into native code (release only)". I think.

    Maybe @jonp or @eno can confirm if it's fixed or what the state of it is.

  • JonathanPryorJonathanPryor USXamarin Team Xamurai

    I believe we removed that option in 4.6.3 or so in VS, though I don't know if XS has had the option removed yet.

    We will be fixing it for 4.8. The fix is still in-progress.

  • FZelleFZelle DEMember ✭✭✭

    So "Bundle assemblies into native code" will be available in 4.8 for Android?

  • JonathanPryorJonathanPryor USXamarin Team Xamurai

    So "Bundle assemblies into native code" will be available in 4.8 for Android?

    That is the current aim.

  • LeighBowersLeighBowers GBMember

    Thanks for the clarification. I wasn't sure if I had to have that option enabled for the app to be accepted by the Google Play store.

  • ReneReezigtReneReezigt USMember

    but i want to turn on Bundle assemblies into native code. How come ?

  • FZelleFZelle DEMember ✭✭✭

    As it is not implemented in either Xamarin Studio or VS.NET Extension you can't.

    You have to wait until it is ready.

  • DavidHowardDavidHoward USMember

    I had the same issue, Release build is failing, complaining that the NDK is missing, yet Debug build works.
    See post : https://forums.xamarin.com/discussion/7871/missing-android-ndk-toolchains-directory

    The root cause is that "MakeBundleNativeCodeExternal" is true for release and false for Debug. Although this appears as a licensing issue, the build agent has an Enterprise licence installed.

    Editing the Android project in notepad, seach for 'BundleAssemblies' - and change the 'True' under Release configuration section to ' False' save, build Release, works :smile:

Sign In or Register to comment.