Saturday, January 24, 2015

[AIR] How to build ANE 64-bit


How to build ANE 64-bit

TL;TR

http://easynativeextensions.com/making-your-ios-apps-universal/

Or try doing thing backward here ;)

  1. Open your Mac.
  2. Open Facebook check it fast and close it!
  3. Make sure Adobe AIR SDK is update to most recent by brew it. (or install if you don't have one)
  4. $ brew upgrade adobe-air-sdk
  5. Make sure AIR SDK path is set.
    $ export AIR_HOME=/usr/local/Cellar/adobe-air-sdk/16.0.0.272/libexec
  6. Clone my working ANE 64-bit ready https://github.com/katopz/ane-device-file-util
  7. Go to /ane-device-file-util/as3/bin
    $ cd /ane-device-file-util/as3/bin
    try
    $ bash build.sh
  8. Open your Twitter, tweet something and close it!
  9. Smile!
  10. That's it! 
You just build ANE from working static library "libDeviceFileUtil.a", now let's try make one your own! Follow this step below...
  1. open my /ane-device-file-util/xcode/DeviceFileUtil.xcodeproj
  2. Target iOS Device just in case
  3. Product -> Archive
  4. You should see "libDeviceFileUtil.a" as link to library in /ane-device-file-util/as3/bin
  5. Right click on it and select "Show Original"
  6. copy real "libDeviceFileUtil.a" which landing somewhere like this
    /Users/katopz/Library/Developer/Xcode/DerivedData/DeviceFileUtil-duuxfozodbsnpvcpelrqiicctqps/Build/Intermediates/ArchiveIntermediates/DeviceFileUtil/IntermediateBuildFilesPath/UninstalledProducts/libDeviceFileUtil.a 
    to (Yes replace it)
    /ane-device-file-util/as3/bin/libDeviceFileUtil.a 
  7. Make sure our .a is 64-bit
    $ xcrun -sdk iphoneos lipo -info libPhotosAlbum.a
    you should see some clang warning and finally at last line...
    Architectures in the fat file: libPhotosAlbum.a are: armv7 arm64 
  8. Now run build.sh again everything should be fine.
  9. Open your Twitter, tweet for your success and close it!
  10. Click ads on this page.
  11. Gotcha! Thanks.
You just build static library and ANE! great job!, now let's check it working!
  1. Use ANE like usual
  2. Build your ipa e.g. Main.ipa
  3. Unzip to somewhere e.g. "/Main"
  4. Now run this in terminal
    $ lipo Main/Payload/Main.app/Main -info
    You should see
    Architectures in the fat file: Main/Payload/Main.app/Main are: armv7 arm64 
  5. Or try this for fun
    $ file Main/Payload/Main.app/Main
    Will get
    Main/Payload/Main.app/Main: Mach-O universal binary with 2 architectures
    Main/Payload/Main.app/Main (for architecture armv7):    Mach-O executable arm
    Main/Payload/Main.app/Main (for architecture arm64):    Mach-O 64-bit executable
  6. That's it!
This backward technique is usually use by me! LOL, I love to hack from working one when learning something and tear them apart more than build from scratch. ;)

Troubleshooting, If you see this
Error: Apple App Store allows only universal applications. "libDeviceFileUtil.a" is not a universal binary. Please change build settings in Xcode project to "Standard Architecture" to create universal library/framework.

It's mean "your-cool-lib.a" is not 64-bit yet, try setup Architecture like picture above.

Happy 64-bit! :D

Post a Comment