• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Android ANE PackagedResources Bug

Community Beginner ,
May 20, 2014 May 20, 2014

Copy link to clipboard

Copied

We have one ANE for handling all Facebook communications, to build this I use <packagedDependencies> in my platform options on Android to reference facebooksdk.jar, and <packagedResources> to package in the res folder of facebook (renaming it to facebook_res).  If used on it's own, this works perfectly.

However, if you seemingly use any other ANE that also uses <packagedDependencies>, or <packagedResources>, the whole thing falls over in a very confusing manner.

This is a fairly complex issue, so I've created the necessary amount of projects as examples, and thrown them up to SixMinute/ANEResourcesBugExample · GitHub, https://github.com/SixMinute/ANEResourcesBugExample/archive/master.zip.

When a second ANE is included, basically the R.java file, and it's siblings don't seem to be created, or compiled into com.facebook.android, which is where they're supposed to go.  In the example I've provided, I ran the eventual apk (ANE3Test) through the decompiler at Android APK Decompiler, and after getting the error "java.lang.NoClassDefFoundError: com.facebook.android.R$layout", the decompiled package (which is also up on GitHub in ANE3Source) shows that indeed, src/com/facebook/android contains no R.java files.  Weirdly, they do appear in src/air/com/sixminute/ANE3Test/debug, the default package for the entry point, and also if I add a dummy <packagedResources> element into the ANE2 project, the R.java files would end up in src/com/chartboost/android as well, but still not where they should be in src/com/facebook/android.

This basically prevents us (and probably anyone else) from using the new resource Android packaging system at all <packagedResources>, or only able to use the new system with one ANE only, and have to unzip the jars as was done previously for all the rest.

Bugbase link - Bug#3763065 - Android ANE PackagedResources Bug

TOPICS
Performance issues

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 20, 2014 May 20, 2014

Copy link to clipboard

Copied

Hi,

Thanks for reporting the issue and explaining it with sample sources. We already have a similar issue under investigations with us and is reported at https://bugbase.adobe.com/index.cfm?event=bug&id=3752414

-Thanks once again

Pahup

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 20, 2014 May 20, 2014

Copy link to clipboard

Copied

Hi Pahup,


I see that it's very similar (and almost certainly the same bug source), but one thing that I don't think either side pointed out in that bug conversation is the R.java in the default folder, src/air/com/sixminute/ANE3Test/debug for us.  Also in that bug, MilkMan are talking about multiple projects using multiple <packagedResources>, in the example that I'm providing, only one ANE is using <packagedResources>.  Both are using <packagedDependencies>, but when the second ANE is included, those resources disappear.


Also, I've just added a second branch multiple_resource_anes, SixMinute/ANEResourcesBugExample at multiple_resource_anes · GitHub (again including source) which shows the weirder behaviour, when you've multiple ANEs which use packagedResources.  In this specific case, src/com/chartboost/android - ANEResourcesBugExample/ANE3Source/src/com/chartboost/android at multiple_resource_anes · SixMinute/A... gets R.java, which contains it's *only* entry (com_chartboost_fragment), but also *all* the other R entries that should be in src/com/facebook/android - ANEResourcesBugExample/ANE3Source/src/com/facebook/android at multiple_resource_anes · SixMinute/ANE..., but aren't.

So while the other bug is correct, I don't think it's thorough enough, nor gets to the whole problem.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 20, 2014 May 20, 2014

Copy link to clipboard

Copied

Sorry, and also, at this point, all the R files are also still in ANEResourcesBugExample/ANE3Source/src/air/com/sixminute/ANE3Test/debug at multiple_resource_anes · S... .  So the only place it *doesn't* go to is where those R files were generated from, and were supposed to go to, src/com/facebook/android.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 20, 2014 May 20, 2014

Copy link to clipboard

Copied

alright, thanks for the explanation, we will investigate 3763065 as well.

-Pahup

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 20, 2014 May 20, 2014

Copy link to clipboard

Copied

Great stuff, thanks Pahup.  And if any more testing, source or anything at all is needed, don't hesitate to contact me, we'd be very eager to get this sorted.    

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
May 21, 2014 May 21, 2014

Copy link to clipboard

Copied

Hi Séadna,

I have tried the app provided by you and tested it with the latest beta build which is AIR 14.0.0.92 and found the R* classes are getting generated, though yes I can see that in the de-compiled APK shared by you(ANE3Source) doesn't contain the R* classes for facebook.

I am using following packaging command:

adt -package -target apk -storetype pkcs12 -keystore abc.p12 airbeta14.apk ANET3est-app.xml ANET3est.swf -extdir ../libs/

where libs contain both of the ANEs.

Can you please try with latest AIR 14 Beta build if not doing already? Also can you please share the OS and java version of your machine.

Thanks,

Nimisha

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 21, 2014 May 21, 2014

Copy link to clipboard

Copied

Hi Nimisha,

Thanks for the response, but unfortunately after checking all that, everything stayed just as was.

I've just added the ant build that we're building with now (I was just launching with FlashBuilder default).  In the ANE3/build folder, an "ant" command would replicate exactly how we're building it, so long as AIR_HOME, KEYFILE and KEYPASS are set (we're just using the FlashBuilder key, and password /Applications/Adobe\ Flash\ Builder\ 4.7/eclipse/plugins/com.adobe.flexide.multiplatform.android_4.7.0.349722/resources/debug-certificate-android.p12, so that might not need to change for you) ANEResourcesBugExample/ANE3/build/build.properties at multiple_resource_anes · SixMinute/ANEResource... .

When we run that (it also spits out the OS, Java and AIR version info), we get,

Mac

Mac OS X x86_64 10.9.3

Java

1.6.0_65-b14-462-11M4609 - /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

AIR

14.0.0.92

attempting uninstall of com.sixminute.ANE3Test.debug

packaging ANE3Test.apk

/Developer/repos/git/frameworks/airsdks/current/bin/adt \

     -package -target apk \

     -storetype pkcs12 -keystore "/Applications/Adobe Flash Builder 4.7/eclipse/plugins/com.adobe.flexide.multiplatform.android_4.7.0.349722/resources/debug-certificate-android.p12" -storepass debug \

     ANE3Test.apk ANE3Test-app.xml ANE3Test.swf

     -extdir ../libs/

But then, once again, when I click "Login", I get the exact same error again.

I would be available over Skype, or a multitude of other chat platforms to potentially get to the bottom of this quicker.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
May 22, 2014 May 22, 2014

Copy link to clipboard

Copied

Hi Séadna,

I am now able to reproduce the bug with java 6 and java 7, earlier I was using Java 8. The bug is fixed now as I can see R* classes getting generated correctly and facebook login gets open on clicking "login" button. The fix will be available in next AIR 14 beta build.

Thanks for reporting the issue!

-Nimisha

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 22, 2014 May 22, 2014

Copy link to clipboard

Copied

Ok, I'm now building with Java 8, and it is better but definitely still not right.  I'm now at the state of Milkman's bug, where the R.java is only constructed for one of the ANEs, but not all.  Again, I've pushed all my files to SixMinute/ANEResourcesBugExample · GitHub.

@Nitisha, while it looked like all was alright previously, on checking again, it only looked like all was right because ANE2 wasn't referencing any resources.  Now though, on tap of "Initialise", we do

            ANE2Extension.DLog("test resource");

            try {

                ANE2Extension.DLog("id: '" + R.layout.com_chartboost_fragment + "'");

            } catch (Exception e) {

                ANE2Extension.DLog( e + " - " + e.getLocalizedMessage() );

            }

            ANE2Extension.DLog("test resource over");

           

But that resource cannot be found, and in LogCat, we also see the error

VFY: unable to resolve static field 1673 (com_chartboost_fragment) in Lcom/chartboost/android/R$layout;

But doing the exact same with ANE1,

            ANE1Extension.DLog("test resource");

            try {

                ANE1Extension.DLog("id: '" + R.layout.com_facebook_login_activity_layout + "'");

            } catch (Exception e) {

                ANE1Extension.DLog( e + " - " + e.getLocalizedMessage() );

            }

            ANE1Extension.DLog("test resource over");

           

works perfectly,

05-22 15:39:24.285: I/ANE1(29554): test resource

05-22 15:39:24.285: I/ANE1(29554): id: '2130903042'

05-22 15:39:24.285: I/ANE1(29554): test resource over

For the moment, for our project, while imperfect, this is acceptable.  The only 3rd party library with loads of resources we're using is Facebook, so for that guy, we can just leave him be, but getting this sorted at some stage really would be great.

Thanks for all your help thus far.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
May 22, 2014 May 22, 2014

Copy link to clipboard

Copied

Hi Séadna,

Please wait for next AIR 14 beta build to see all these issues resolved

-Nimisha

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 28, 2014 May 28, 2014

Copy link to clipboard

Copied

LATEST

Awesome, awesome, awesome!  Just got the email announcement from Chris about the latest AIR release, downloaded and checked, and all is 100% sorted, even with old Java, the resources from both the ANEs are there, perfectly.  Thanks so much for helping out in this thread, and then getting the whole thing sorted with this release, it's massively appreciated!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines