HaxeExtension / extension-ouya

Extension for additional OUYA support
13 stars 4 forks source link

Problem building the master branch version #2

Open marcelofrau opened 11 years ago

marcelofrau commented 11 years ago

Hello,

I just downloaded the master files and I am currently unable to build, I think this can be some misconfiguration on my enviroment perhaps?

When I try to execute the build with openfl build android or openfl test android, a error shows up and the build process terminate.

This is the message on the cmd output:

PS C:\Users\Keitaro\Desktop\ouya\projetos\ouya_iap_openfl-master> openfl build android C:\HaxeToolkit\haxe\lib\openfl-ouya/1,0,2/tv/ouya/console/api/OuyaResponseListener.hx:8: characters 39-71 : openfl.utils.#JNI has no field createInterface C:\HaxeToolkit\haxe\lib\openfl-ouya/1,0,2/tv/ouya/console/api/OuyaResponseListener.hx:8: characters 125-133 : Unknown identifier : classDef src/Main.hx:50: characters 30-50 : Cannot access private field __jobject PS C:\Users\Keitaro\Desktop\ouya\projetos\ouya_iap_openfl-master> .\uploadOUYA.bat

What can I do to build normally this project? Thank you.

jarnik commented 11 years ago

Marcelofrau: I have encountered the same problem (see #1) - the createInterface method is missing in the latest version of openfl/openfl-native (I guessed jgranick had it in his working copy but did not push to the repo).

That's why I created jarnik/ouya_iap_openfl, using custom JNI handlers. The temporary solution is to comment out every reference to "createInterface" within "C:\HaxeToolkit\haxe\lib\openfl-ouya/1,0,2/tv/ouya/console/api/OuyaResponseListener.hx" or any other class.

marcelofrau commented 11 years ago

I managed to have a solution for this. I am unable to post the solution I've found right now. I'll post here later on what I have done to solve the problem.

Is a patch that I made on the JNI.hx, I think it's about 10 lines of code. I implemented the createInterface method so the openfl-ouya can reach the missing methods.

marcelofrau commented 11 years ago

Sorry for the delay. I included these lines after line 64 on the JNI.hx file:

private static var alreadyCreated = new Map<String, Bool>();
private static var base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

public static function createInterface(haxeClass:Dynamic, className:String, classDef:String):Dynamic {
    var bytes:Bytes = null;
    if (!alreadyCreated.get(className)) {
        bytes = Bytes.ofString(BaseCode.decode(classDef, base64));
        bytes = Uncompress.run(bytes, 9);
        alreadyCreated.set(className, true);
    }
    return nme_jni_create_interface(haxeClass, className, bytes == null ? null : bytes.getData());
}

private static var nme_jni_create_interface = Lib.load("nme", "nme_jni_create_interface", 3);