Copy link to clipboard
Copied
Hi all,
I am building a native extension for the Android platform that is exhibiting a problem where annotations used by a 3rd party dependency JAR (CRest) within the native extension are not being found at runtime. This causes a crash when the annotations are validated.
As a bit of background, the native extension is simply a wrapper for an existing custom JAR along with it's dependency JAR's - these are merged into a single JAR required for the extension build process. When the merged JAR is used in a standard Android applicaiton it works as expected at runtime so this problem only appears to be when using the JAR via the Adobe AIR runtime on Android.
It took quite a while to work out the exact problem due to it being such a strange runtime error, but once I had figured out the actual issue I tried a number of things to resolve the problem, including updating the AIR SDK to 3.9 (generally I've been using 3.7 to match the version used by our partner developers) and updating the version of Android used by the AIR SDK. So far I've not had any luck and the only suggested solution I've been able to find regarding this is that the JAR needs adding to the runtime classpath, but I can't seem to find a way of explicitly doing this via Adobe Flash Builder.
Although quite a specific scenario, I was wondering if anyone else had come across this situation and knew of a fix or viable workaround?
Thanks,
Duane
Copy link to clipboard
Copied
Hi Duane,
If I am not wrong then you're trying to build a native extension which is using a third party jar. With AIR 4.0, a new feature is introduced "Support for native resources access by R* mechanism in native extension" you can read more about it @http://labsdownload.adobe.com/pub/labs/flashruntimes/shared/air4-0_flashplayer12-0_releasenotes.pdf. This feature allows you to use the third party jar in your ANE project and all you have to do is to make your ANE project a library project and then have to include this third party jar in it, apart from that you have to provide platform.xml(where you can define the jar dependencies) while packaging the ANE(more details in release notes pdf).
Let me know if you have any queries.
Thanks,
Nimisha
Copy link to clipboard
Copied
Thanks Nimisha, that looks similar to the way the iOS dependency libraries are packaged for the ANE so perhaps that will resolve the problem and save me having to merge the JAR's together.
I'll have a go at using the 4.0 beta AIR SDK and let you know if that works.
Copy link to clipboard
Copied
@Nimisha I've updated to AIR SDK 4.0 and added the 3rd party JAR's as dependency packages which builds but unfortunately still fails with the same missing annotations problem at runtime.
You mention specifying the ANE as a library project - how do I do this?
Copy link to clipboard
Copied
In eclipse go to project Properties -> Android and check isLibrary property.
Copy link to clipboard
Copied
@Nimisha Ah, I thought this was referring to something on the Actionscript/Flash Builder side. In that case the project is already setup as a library project.
Copy link to clipboard
Copied
Can you please tell me how you're packaging the ANE, have you provided the third party jar while packaging the ANE and have also mentioned it's entry in the platform.xml with ns 4.0?
Copy link to clipboard
Copied
Yes. The 3rd party JAR is specified as a packageDependency in the platfrom.xml file like so:
<platform xmlns="http://ns.adobe.com/air/extension/4.0">
...
<packagedDependencies>
...
<packagedDependency>codegist-crest-2.0.0-RC1-all.jar</packagedDependency>
...
</packagedDependencies>
...
</platform>
The JAR is then located where my assets and other dependencies are pulled from via the ANE packaging process.
Copy link to clipboard
Copied
I am not able to figure out what is going wrong here so can you please share the resources of ANE (which inclued jar(s),platform.xml , extension.xml, swc,library swf and res)with me with the packaging command @nimisha1@adobe.com?
Copy link to clipboard
Copied
Yeah sure, email sent with further details.
Thanks Nimisha!
Copy link to clipboard
Copied
Hey there Duane. We are experiencing this same issue with a customer of ours and are really interested in knowing if you figured out a solution? Please let us know. Thanks.!
Copy link to clipboard
Copied
Due to time constraints I had to resort to a non-annotation based solution unfortunately, but I provided Nimisha and the Adobe team with a sample demonstrating the issue that they were investigating.
I hope that helps,
Duane
Copy link to clipboard
Copied
I use SDK Air 14.0 and i'm getting right now that problem too. (Windows 7 64bits, FlashDevelop, AirSDK FlexAirsdk 4.6.0+14.0.0, Min android version 9, target 20)
I use FatJar ( Fat Jar Eclipse Plug-In ) to merge all libs on 1 jar. On full Android projects everything works with this jar. But not using on an ANE in Adobe Air.
I get a error: a class is not found (com.google.android.gms.common.GooglePlayServicesUtil) on runtime. I have tried to not include this lib on the merged jar and use the platform.xml to link this third party but i received the same error.
Everything seems to point to a bug on the Adobe Air SDK.
If you need more info, code, etc... let me know.
Grettings.
Copy link to clipboard
Copied
Hi sshk5,
I had a similar issue where the com/google/android/gms/common/api/GoogleApiClient$ConnectionCallbacks was not found. Doing some Googling around I found this post: https://github.com/playgameservices/play-games-plugin-for-unity/issues/193
I downloaded Rev. 20 of the Android SDK platform tools and build tools. From those tools I copied all the files I needed to replace what's in the lib\android\bin folder of the AIR SDK. Then I rebuilt my app and that solved the issue for me.
I hope that helps.
Copy link to clipboard
Copied
Hi JulianDMG,
I have looked very fast, what's files have you replace? ONLY aapt.exe and adb.exe? or someone more?
I will try later.
Thanks
Copy link to clipboard
Copied
Hi sshk5,
I replaced ALL files in the lib\android\bin folder of the AIR SDK. Here's the list:
adb.exe
AdbWinApi.dll
AdbWinUsbApi.dll
aapt.exe
dx.jar
The first 3 files are part of the Android SDK platform tools and the other 2 are part of the build tools.
Copy link to clipboard
Copied
Hi Nimisha,
Has there been any progress on this disappearing-annotations problem? I'm seeing the same symptoms that Duane saw; even the simplest native extension for Android will throw a class not found exception if it includes annotations (in this case, using Retrofit for network communication).
I tried updating the Android files in my AIR SDK based on JulianDMG's post, but that resulted in an error during the compilation process:
"aapt tool failed:ERROR: Asset package include android-res.jar not found"
Are annotations just completely unsupported?