Compile error when trying to compile with Enhance extension


#1

For those that don’t know, this is an “extension” by FGL for displaying ads and similar features. I’ve asked in their forums too, but thought maybe someone here could have an idea of what’s wrong.

I’m using OpenFL 3.6.1, with HaxeFlixel 4.2.1, Lime 2.9.1.

All that needs to be done is include haxe <include path="Enhance-Extension"/> in project.xml, but when I compile, the following error appears:

 - src/EnhanceInAppPurchases.cpp 
Error: ./src/EnhanceInAppPurchases.cpp: In member function 'Void EnhanceInAppPurchases_obj::__construct()':
./src/EnhanceInAppPurchases.cpp:21:18: error: '::lime' has not been declared
  Dynamic tmp = ::lime::_system::JNI_obj::createStaticMethod(HX_HCSTRING("org.haxe.extension.Enhance","\x21","\x87","\xd9","\x7f"),HX_HCSTRING("isPurchasingSupported","\x46","\xb5","\xbf","\xbd"),HX_HCSTRING("()Z","\x39","\x7e","\x1e","\x00"),null(),null());  HX_STACK_VAR(tmp,"tmp");
                  ^
./src/EnhanceInAppPurchases.cpp:25:19: error: '::lime' has not been declared
  Dynamic tmp1 = ::lime::_system::JNI_obj::createStaticMethod(HX_HCSTRING("org.haxe.extension.Enhance","\x21","\x87","\xd9","\x7f"),HX_HCSTRING("attemptPurchase","\xee","\xcd","\xc1","\x85"),HX_HCSTRING("(Ljava/lang/String;)V","\x7f","\xb4","\xbc","\xc7"),null(),null());  HX_STACK_VAR(tmp1,"tmp1");
                   ^
./src/EnhanceInAppPurchases.cpp:29:19: error: '::lime' has not been declared
  Dynamic tmp2 = ::lime::_system::JNI_obj::createStaticMethod(HX_HCSTRING("org.haxe.extension.Enhance","\x21","\x87","\xd9","\x7f"),HX_HCSTRING("getDisplayPrice","\x9d","\x7a","\xce","\xf7"),HX_HCSTRING("(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;","\x77","\xff","\xf6","\x70"),null(),null());  HX_STACK_VAR(tmp2,"tmp2");
                   ^
./src/EnhanceInAppPurchases.cpp:33:19: error: '::lime' has not been declared
  Dynamic tmp3 = ::lime::_system::JNI_obj::createStaticMethod(HX_HCSTRING("org.haxe.extension.Enhance","\x21","\x87","\xd9","\x7f"),HX_HCSTRING("isItemOwned","\xc8","\xb4","\xe2","\x16"),HX_HCSTRING("(Ljava/lang/String;)Z","\x83","\xb4","\xbc","\xc7"),null(),null());  HX_STACK_VAR(tmp3,"tmp3");
                   ^
./src/EnhanceInAppPurchases.cpp:37:19: error: '::lime' has not been declared
  Dynamic tmp4 = ::lime::_system::JNI_obj::createStaticMethod(HX_HCSTRING("org.haxe.extension.Enhance","\x21","\x87","\xd9","\x7f"),HX_HCSTRING("getOwnedItemCount","\x0d","\xf5","\x4e","\x69"),HX_HCSTRING("(Ljava/lang/String;)I","\x72","\xb4","\xbc","\xc7"),null(),null());  HX_STACK_VAR(tmp4,"tmp4");
                   ^
./src/EnhanceInAppPurchases.cpp:41:19: error: '::lime' has not been declared
  Dynamic tmp5 = ::lime::_system::JNI_obj::createStaticMethod(HX_HCSTRING("org.haxe.extension.Enhance","\x21","\x87","\xd9","\x7f"),HX_HCSTRING("consume","\xbc","\x79","\xda","\x18"),HX_HCSTRING("(Ljava/lang/String;)V","\x7f","\xb4","\xbc","\xc7"),null(),null());  HX_STACK_VAR(tmp5,"tmp5");
                   ^
Build halted with errors.

Perhaps I would need a more recent version of Lime, but I can’t update it because it would have some incompatibility with the version of OpenFL I’m using (if I remember correctly), which is also the latest version compatible with HaxeFlixel.


#2

Yeah, a lot has changed since Lime 2.9.1. That is almost certainly the cause of the error.

You might be able to find an old version of Enhance that’s compatible, but I’m not sure.


#3

The Enhance extension is using the current “lime.system.JNI” but you are using an older version of lime.
Use openfl.utils.JNI instead.