Step-by-step guide on how to add a third party framework to MOE/Xcode

Step-by-step guide on how to add a third party framework to MOE/Xcode

Hi there,

I had several problems with adding a third party framework to Xcode, so for your information here is a step-by-step guide.
I'm using LibGDX with MOE and I tried to add the Appodeal framework, but it should work with any framework.

Step 1: In Android Studio right-click your MOE module and select "Multi-OS Engine Actions->Link third party framework to Xcode".
On the first tab select the framework, on the second tab add all dependencies and needed linker flag (e.g. "-ObjC"). On the third tab add the resources folder of the framework.

Step 2: Right-click your MOE module and select "Open Module Settings". Click the "+" symbol at the bottom, select "File dependency" and add the newly generated "lib/Appodeal.jar" to your module. Now you can access the framework classes in your code. The framework classes are accessible via "com.intel.*", so for example: import com.intel.appodeal.Appodeal

Step 3: Start the app from within Android Studio. This is an important step, as this will copy some needed files for Xcode.
(Without this step, the error message "No implementation found for void com.badlogic.gdx.backends.iosrobovm.IOSGLES20.init()" showed up when my app was started in Xcode)
After starting the app from Android Studio, right click on your MOE module and select "Multi-OS Engine Actions->Open Project in Xcode".

Step 4: Open the Mac finder and drag the framework to the "Project Navigator->[name of ios module]->Frameworks" list.
Important: After that the linker couldn't find the framework. I had to copy the framework to "/Applications/Intel/multi_os_engine/sdk/iphoneos" and "/Applications/Intel/multi_os_engine/sdk/iphonesimulator". Then the linker could find the framework. (I think it has to do with Build-Settings->Search Paths->Framework Search Paths)

Step 5: Drag the resources folder of the framework to the "Supporting Files" folder. Select "copy files as needed".

Step 6: Click the "+"-symbol at "Build Phases->Link Binary With Libraries" and add all needed dependencies

Step 7: After that the app complained about "FAILURE: Binding class refers to class Appodeal, but it can not be found". I was able to fix this with adding the flag "-ObjC" to "Build Settings->Other Linker Flags->Debug" and "Build Settings->Other Linker Flags->Release".

After that the framework should be active and usable.
If you get an error like "Transport security has blocked a cleartext HTTP (http://) resource load since it is insecure", you have to add the key "App Transport Security Settings" to "Info->Custom iOS Target Properties" and under this add another key "Allow Arbitary Loads" with the value "YES".

(this is Appodeal specific: If you get an error message that there is a problem with the bundle ID/app key, first double check the app key and the bundle ID. If both is correct, check if the key "Info->Custom iOS Target Properties->Bundle versions" has a value. It is odd, but if the value is missing, you will also get the error message.)

I'm wondering why you first need to add all the informations (dependencies, flags, resources) to the "Link third party framework to Xcode" window and later add the same informations again to Xcode. Is this correct?

 

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Dear Tobias,

Yes, currently you need to do this extra step. The reason is (and I just realised this is why my guide didn't work for you) is that the add third party framework feature only works with 'moe.xcode.generateProject' set to 'true' and when you create a libGDX project this value is 'false'. That means when you are building the project, the build process cannot modify your Xcode project in order to configure the required settings, thus you need to make those changes yourself.

Thank you for your guide!

Best Regards,
Kristóf

I'm in the same problem, but with another framework

Cita:

Kristof Liliom - Migeran Ltd escribió:

Dear Tobias,

Yes, currently you need to do this extra step. The reason is (and I just realised this is why my guide didn't work for you) is that the add third party framework feature only works with 'moe.xcode.generateProject' set to 'true' and when you create a libGDX project this value is 'false'. That means when you are building the project, the build process cannot modify your Xcode project in order to configure the required settings, thus you need to make those changes yourself.

Thank you for your guide!

Best Regards,
Kristóf

That's mean if i don't want to do all those steps above i have to change 'moe.xcode.generateProject' to 'true' ? That's right? 

 

@Kristóf: Today I tried if I can omit the steps in Xcode, if I set "generateProject" to true.
So I changed build.gradle of the MOE module and set "moe->xcode->generateProject" from false to true.

But then the gradle sync fails with:
Error: Cannot change dependencies of configuration ":ios-moe:compile" after it has been resolved.

How can I fix this?

 

Dear Tobias,

As far as I know, the libGDX + MOE combination currently does not support the generateProject = true setting.

Best Regards,
Kristóf

Dear Thanh,

If you have a libGDX project, then you need to to all the steps mentioned above.

Best Regards,
Kristóf

Leave a Comment

Please sign in to add a comment. Not a member? Join today