freshplanet / ANE-Facebook

Air Native Extension (iOS and Android) for the Facebook mobile SDK
Apache License 2.0
221 stars 123 forks source link

Build ANE from source, it references the original source files at runtime #211

Closed jacobholm closed 9 years ago

jacobholm commented 9 years ago

Hi,

I use the included build script and build using ant. The ane is built, I copy it to my project and include it as a native extension. Everything builds and looks good, but when I run the application I can see that it references the original source files. This is what I get when I try to initialize the library using Facebook.getInstance().init()

TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.freshplanet.ane.AirFacebook::Facebook/init()[D:\ANE-Facebook-master\actionscript\src\com\freshplanet\ane\AirFacebook\Facebook.as:108]

Have I forgotten some setting or parameter somewhere telling it to use the source of the ANE and not the original files?

Regards, Jacob

jacobholm commented 9 years ago

I managed to solve the issue. Forgot exactly how I ran the script, but when I tried today I got it working. I did the following changes:

build.config I set "bin.ext = .exe".

extension.xml I removed "platform name="iPhone-ARM"" and its content (I am building for android).

build.xml I removed "ios" from the depends attribute in the "target name="all" depends="android,swc,package" description="Full build of extension"/" tag. Then I added "${bin.ext}" to "exec executable="${flex.sdk}/lib/android/bin/aapt${bin.ext}"" as it was missing. Without this the ".exe" I set in build.config have no effect. I also had to add ".bat" to the "<exec executable="${flex.sdk}/bin/adt.bat"" under the package target tab. It seems this particular one did not want to run as an exe.

After these changes the ANE built succesfully and was placed in the bin folder. Maybe this helps someone else.