Copy link to clipboard
Copied
I am trying to add latest Google Plus (google-play-services.jar) support to an Air mobile app by creating a native extension.
The code doesn't have compile-time errors or warnings, the JAR is exported fine, ANE is built and included in project without problems,
but when I run my apk, it crushes. In device-crush-logs I can see following error:
12-04 11:08:18.602 23195 23195 I dalvikvm: Failed resolving Lcom/google/example/games/basegameutils/GameHelper; interface 940 'Lcom/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks;' | |
12-04 11:08:18.602 23195 23195 W dalvikvm: Link of class 'Lcom/google/example/games/basegameutils/GameHelper;' failed |
At first I tried to build an extension from empty project, all by myself.
After that I found an extension with open source at github http://github.com/alextel69/google-play-game-services-ane/
I build that extension and include in my AIR mobile project and it works fine, but the google-play-services.jar is too old and doesn't contain classes I need,
so i tried to replace it's libs/google-play-services.jar and libs/android-support-v4.jar with the newest ones that I got in my Android SDK Manager.
And that caused the above errors.
In this way, I did not modify a single code line, or ANT's build.xml, or anything else, I just switched old android-support-v4.jar + google-play-services.jar (works fine!) with newer android-support-v4.jar + google-play-services.jar (fails). I mean the ANE is built fine, even the extension is created and some of it's methods work and return values, but as I referense to google-service code, I get that strange error.
Though interfaces in both old and new JARs seem to be equal: https://dl.dropboxusercontent.com/u/13839683/ane/jars_compare.png .
By the way, these errors seem to appear in AIR mobile only. Pure native application using these android-support-v4.jar + google-play-services.jar have no problems.
Here is a brief scheme of my native extension:
https://dl.dropboxusercontent.com/u/13839683/ane/scheme.png
And here is a complete device log from extension's birth and till it's crush : http://pastebin.com/iqvR3niD
----
inb4
----
I discovered this issue very@ thoroughly and found several simular threads, but none of them resolved my problem
1) The solution of http://stackoverflow.com/questions/22956979/google-plus-ane-air-native-extension-failed-resolving-in...
> jar xf /path-to-play-services-project/libs/google-play-services.jar
> jar uf ./my_gplus_extension.jar ./com
does not fix anything.
2) Any manipulations with Eclipse http://stackoverflow.com/questions/23104532/adobe-air-4-0-native-extension-with-google-play-services don't help either (after all, I am building JAR using ANT).
3) I do modify resourses (\google-play-services_lib\res\*.*) when switching to a new google-service-library.
4) I even tried to extend google's interfaces and modified my GameHelper to implement them, but that did not help either (http://dl.dropboxusercontent.com/u/13839683/ane/extend_interface.jpg).
Thank you for response, Alexey! I will definitely read this article.
Also I have to say, that I managed to solve partially this problem. I asked the same question on starling-forum and it's member tsangwailam suggested me to replace the dx.jar in AIR SDK to the new one in Android SDK.
replacing dx.jar really helped. I took %ANDROID_SKD%\sdk\build-tools\19.1.0\lib\dx.jar and copied it into %FLEXSDK%\lib\android\bin\dx.jar
and the extension began to work correctly!
but...
as soon as I run an activity S
...Copy link to clipboard
Copied
I also tried some time ago to run new google-play-services.jar in ane with no luck. In this article you can find paragraph about Java version supported by AIR: Developing and using Adobe AIR native extensions for Android devices | Adobe Developer Connection.
Author states that "At this point Adobe tooling is not quite compatible with Java 7 and you may run into errors at linking and packaging time." I think this is the case. My own jar built with Java 7 was working.
It would be nice to confirm from staff that AIR will support Java 7 someday.
Copy link to clipboard
Copied
Thank you for response, Alexey! I will definitely read this article.
Also I have to say, that I managed to solve partially this problem. I asked the same question on starling-forum and it's member tsangwailam suggested me to replace the dx.jar in AIR SDK to the new one in Android SDK.
replacing dx.jar really helped. I took %ANDROID_SKD%\sdk\build-tools\19.1.0\lib\dx.jar and copied it into %FLEXSDK%\lib\android\bin\dx.jar
and the extension began to work correctly!
but...
as soon as I run an activity SingInActivity
Intent intent = new Intent(context.getActivity().getApplicationContext(), SingInActivity.class);
context.getActivity().startActivity(intent);
my application becomes inactive - fails to handle touches.
it seems like some invisible modal popup appears and does'n allow my application to catch taps.
after minimizing and restoring my application I see that SingInActivity steps into mehtod "protected void onStart()" and I know my applicatins "sees" it, because I log it using FREContext.dispatchStatusEventAsync() into my Flash's textfield, but application is stil not able to handle user inputs (both native flash and starling/stage3d TouchEvents)
it's an interesting fact, that when my AIR application loses ability to handle touches, android's navigating buttons turn from hidden dots into actual buttons :
https://dl.dropboxusercontent.com/u/13839683/ane/untouchable.png
as for device log, I don't see there any erros, or Java ecxeptions, or nothing (at least for me) that could explain such behavior.
Copy link to clipboard
Copied
Nice trick with dx.jar! I will try it I will write to starling forum.
Copy link to clipboard
Copied
Why air SDK 17 still not support Java7 ?