locked
Create Package in XS RRS feed

  • Question

  • User59 posted

    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!

    Wednesday, February 27, 2013 11:15 PM

All replies

  • User59 posted

    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?

    Thursday, February 28, 2013 9:51 AM
  • User59 posted

    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? :)

    Thursday, February 28, 2013 10:19 AM
  • User59 posted

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

    Turn it off, and it starts working.

    but why?

    Thursday, February 28, 2013 10:40 AM
  • User48 posted

    but why?

    Because we broke mkbundle support. Sorry.

    Thursday, February 28, 2013 4:32 PM
  • User59 posted

    @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!

    Thursday, February 28, 2013 4:33 PM
  • User54 posted

    @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.

    Thursday, February 28, 2013 7:10 PM
  • User59 posted

    @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!

    Friday, March 1, 2013 1:39 PM
  • User956 posted

    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 :)

    Saturday, March 2, 2013 7:06 PM
  • User59 posted

    @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.

    Saturday, March 2, 2013 7:24 PM
  • User956 posted

    Thanks nicwise!

    Saturday, March 2, 2013 7:38 PM
  • User158 posted

    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?

    Thursday, May 2, 2013 9:31 AM
  • User59 posted

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

    Thursday, May 2, 2013 9:48 AM
  • User158 posted

    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.

    Thursday, May 2, 2013 9:55 AM
  • User59 posted

    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.

    Thursday, May 2, 2013 10:02 AM
  • User48 posted

    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.

    Thursday, May 2, 2013 3:09 PM
  • User565 posted

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

    Thursday, May 2, 2013 4:37 PM
  • User48 posted

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

    That is the current aim.

    Thursday, May 2, 2013 9:04 PM
  • User158 posted

    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.

    Friday, May 3, 2013 11:35 AM
  • User10842 posted

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

    Friday, May 31, 2013 11:20 AM
  • User565 posted

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

    You have to wait until it is ready.

    Friday, May 31, 2013 11:36 AM
  • User43131 posted

    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:

    Monday, November 23, 2015 4:05 PM