Apache Cordova
  1. Apache Cordova
  2. CB-7675

custom_rules.xml breaks FacebookConnect plugin

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 3.6.0
    • Fix Version/s: None
    • Component/s: Android
    • Labels:
      None
    • Environment:

      Windows8

      Description

      The plugin FacebookConnect https://github.com/Wizcorp/phonegap-facebook-plugin builds ok but fails during runtime with NPEs for missing resources.

      After removing the custom_rules.xml the plugin builds and runs fine.

      If the custom_rules.xml file is present the build uses ant-gen and ant-build which seems to confuse the aapt tool or something as the resources get out of sync with the R file?

      Commands:
      cordova platform add android
      cordova plugin add https://github.com/phonegap/phonegap-facebook-plugin.git --variable APP_ID="<id>" --variable APP_NAME="Hello Frosty"
      cordova run

        Issue Links

          Activity

          Hide
          Arne Sikström added a comment -

          I created a test app that will crash and put it here: http://www.frostyelk.se/testarea/hellofacebook.zip
          Pressing the Login button should bring up the FB-login screen and a progressbar but crashes with:
          java.lang.NoClassDefFoundError: com.facebook.android.R$layout

          Delete ant-gen and ant-build from all folders, rename custom_rules.xml and make a new build.
          All functions in the test app should now work.

          Show
          Arne Sikström added a comment - I created a test app that will crash and put it here: http://www.frostyelk.se/testarea/hellofacebook.zip Pressing the Login button should bring up the FB-login screen and a progressbar but crashes with: java.lang.NoClassDefFoundError: com.facebook.android.R$layout Delete ant-gen and ant-build from all folders, rename custom_rules.xml and make a new build. All functions in the test app should now work.
          Hide
          Arne Sikström added a comment -

          Any ideas or workarounds? This is a complete showstopper for us.

          Show
          Arne Sikström added a comment - Any ideas or workarounds? This is a complete showstopper for us.
          Hide
          Andrew Grieve added a comment -

          Two options:
          1. As you pointed out - just delete the custom_rules.xml file
          2. Be an early tester of Gradle-based builds and build via:

          ANDROID_BUILD=gradle cordova build android
          
          Show
          Andrew Grieve added a comment - Two options: 1. As you pointed out - just delete the custom_rules.xml file 2. Be an early tester of Gradle-based builds and build via: ANDROID_BUILD=gradle cordova build android
          Hide
          Arne Sikström added a comment -

          We are using the Intel XDK cloud as our production build system so the solution needs to be within what you can do with Cordova functions.
          What was reason to rename the gen and build folders? If we disable that, what other plugins will stop to work.?

          Show
          Arne Sikström added a comment - We are using the Intel XDK cloud as our production build system so the solution needs to be within what you can do with Cordova functions. What was reason to rename the gen and build folders? If we disable that, what other plugins will stop to work.?
          Hide
          Andrew Grieve added a comment -

          The reason is that it interacts poorly with Eclipse. The real fix here is Gradle, the intended work-around of deleting the file seems pretty simple. Sounds like you should file a bug with XDK to have them always delete the custom_rules.xml.

          Show
          Andrew Grieve added a comment - The reason is that it interacts poorly with Eclipse. The real fix here is Gradle, the intended work-around of deleting the file seems pretty simple. Sounds like you should file a bug with XDK to have them always delete the custom_rules.xml.
          Hide
          Frederico Costa Galvão added a comment -

          Is there anything I need to know or read before I start trying gradle builds (which should solve this)?

          Show
          Frederico Costa Galvão added a comment - Is there anything I need to know or read before I start trying gradle builds (which should solve this)?
          Show
          Andrew Grieve added a comment - Docs for it are here: https://github.com/apache/cordova-docs/blob/b8779e872054735e34aee70e1c2188e71f51702c/docs/en/edge/guide/platforms/android/tools.md

            People

            • Assignee:
              Andrew Grieve
              Reporter:
              Arne Sikström
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development