Highlighted

Android resources with Facebook SDK 4.0

Explorer ,
Mar 27, 2015

Copy link to clipboard

Copied

Hello,

I am trying out the latest Facebook SDK for Android to create an ANE but I have quickly run into issues with resources.

FacebookActivity class uses R.layout.com_facebook_activity_layout and R.id.com_facebook_fragment_container.

If I use the R.* mechanism then the application crashes with 'resource not found' exception,

if I use aneContext.getResourceId then it does not crash but outputs warnings


W/ResourceType﹕ getEntry failing because entryIndex 10 is beyond type entryCount 3

W/ResourceType﹕ Failure getting entry for 0x7f04000a (t=3 e=10) in package 0 (error -2147483647)


I use platform.xml to specify packaged resources. I have to say, I use the same ANE setup (ie. resources packaging) with Facebook SDK 3.23 and it works fine.

The new Facebook SDK works fine in native Android app but in ANE it seems to be failing in class FragmentManager so it basically cannot find the container view.


...

case Fragment.CREATED:

  if (newState > Fragment.CREATED) {

  if (DEBUG) Log.v(TAG, "moveto ACTIVITY_CREATED: " + f);

  if (!f.mFromLayout) {

     ViewGroup container = null;

     if (f.mContainerId != 0) {

         container = (ViewGroup)mContainer.findViewById(f.mContainerId);

         if (container == null && !f.mRestored) {

             throwException(new IllegalArgumentException(

                     "No view found for id 0x"

                     + Integer.toHexString(f.mContainerId) + " ("

                     + f.getResources().getResourceName(f.mContainerId)

                     + ") for fragment " + f));

         }

     }

...

Any ideas that I could try to fix this?

Oh well, so I found out it was actually failing to get the resource R.string so I modified the Facebook SDK source

and replaced R.string calls to ANE Context's getActivity().getString( getResourceId( resourceId ) )


I tried using the platform.xml and packagedResource for various com.facebook packages but still could not get it to work

with the R.* mechanism so this will have to do for now.

TOPICS
Performance issues

Views

458

Likes

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

Android resources with Facebook SDK 4.0

Explorer ,
Mar 27, 2015

Copy link to clipboard

Copied

Hello,

I am trying out the latest Facebook SDK for Android to create an ANE but I have quickly run into issues with resources.

FacebookActivity class uses R.layout.com_facebook_activity_layout and R.id.com_facebook_fragment_container.

If I use the R.* mechanism then the application crashes with 'resource not found' exception,

if I use aneContext.getResourceId then it does not crash but outputs warnings


W/ResourceType﹕ getEntry failing because entryIndex 10 is beyond type entryCount 3

W/ResourceType﹕ Failure getting entry for 0x7f04000a (t=3 e=10) in package 0 (error -2147483647)


I use platform.xml to specify packaged resources. I have to say, I use the same ANE setup (ie. resources packaging) with Facebook SDK 3.23 and it works fine.

The new Facebook SDK works fine in native Android app but in ANE it seems to be failing in class FragmentManager so it basically cannot find the container view.


...

case Fragment.CREATED:

  if (newState > Fragment.CREATED) {

  if (DEBUG) Log.v(TAG, "moveto ACTIVITY_CREATED: " + f);

  if (!f.mFromLayout) {

     ViewGroup container = null;

     if (f.mContainerId != 0) {

         container = (ViewGroup)mContainer.findViewById(f.mContainerId);

         if (container == null && !f.mRestored) {

             throwException(new IllegalArgumentException(

                     "No view found for id 0x"

                     + Integer.toHexString(f.mContainerId) + " ("

                     + f.getResources().getResourceName(f.mContainerId)

                     + ") for fragment " + f));

         }

     }

...

Any ideas that I could try to fix this?

Oh well, so I found out it was actually failing to get the resource R.string so I modified the Facebook SDK source

and replaced R.string calls to ANE Context's getActivity().getString( getResourceId( resourceId ) )


I tried using the platform.xml and packagedResource for various com.facebook packages but still could not get it to work

with the R.* mechanism so this will have to do for now.

TOPICS
Performance issues

Views

459

Likes

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
Mar 27, 2015 0
Explorer ,
Mar 27, 2015

Copy link to clipboard

Copied

Oh well, so I found out it was actually failing to get the resource R.string so I modified the Facebook SDK source

and replaced R.string calls to ANE Context's getActivity().getString( getResourceId( resourceId ) )


I tried using the platform.xml and packagedResource for various com.facebook packages but still could not get it to work

with the R.* mechanism so this will have to do for now.

Likes

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
Reply
Loading...
Mar 27, 2015 0