1

Just read this question (Android facebook applicationId cannot be null) and really hoped it would fix my issue too.

It is similar, however, I'm working with ANT and added the App ID's in the build.xml. The build runs fine, the logs don't show anything weird. I see that the somehow adding the App ID in the Manifest tricks Android into thinking it's an Integer, while it should actually be a String. And whatever I try, I still get the same error and the app keeps crashing.

applicationId cannot be null

I tried escaping the application id's when specifying them, like so:

<property
    name="fb_app_id_a"
    value="\ XXXXXXXXXXXX" />

But it resulted in the same error. So I tried to be smart and added the escaping later, but to no avail:

<replaceregexp
        file="AndroidManifest.xml"
        flags="g"
        match="android:value=&quot;@string/app_id&quot;"
        replace="android:value=&quot;\ ${fb_app_id_a}&quot;" />

I try to replace the conventional implementation with the build.xml, because we have to use several app ID's. Although the logs of the build I ran look fine, still it's giving me hell to get the build automation done because of this issue. Am I doing something wrong, or should I be doing it differently?

Does anybody have experience with build automation and the use of multiple app ID's for Facebook?

Thanks a bunch!

Community
  • 1
  • 1
StingRay5
  • 2,388
  • 2
  • 20
  • 29

1 Answers1

0

What I use to change some value in the manifests file is:

<replaceregexp file="AndroidManifest.xml" match='android:label=".*"'
replace='android:label="my new value"'/>

With this, I will change android:label="some value" to android:label="my new value"

I guess that in your case will be:

<property name="fb_app_id_a" value="some value" />

<replaceregexp file="AndroidManifest.xml" match='property name="fb_app_id_a" value=".*"'
replace='property name="fb_app_id_a" value="your new value"'/>

Also, to decomple the apk and see the AndroidManifest.xml helped me a lot

mromer
  • 1,867
  • 1
  • 13
  • 18
  • Thanks. However, I saw that the value was replaced successfully, but somehow it is read as an integer, rather than a string when it's referenced by the FB SDK. This is what causes the error and crashes the app. This seems to be a known issue for other people as well, but when working directly with the manifest there's a workaround. Sadly it doesn't work when using Ant and add the same in the build.xml. – StingRay5 Aug 14 '14 at 11:38
  • And did you get the app running fine sometime? I mean, setting the property manually? – mromer Aug 14 '14 at 12:10
  • Yes. Setting it manually the way Facebook recommends works fine, but then there's no possibility of switching the app ID's automatically. Also using the escaping works fine as long as it happens in the AndroidManifest itself. It goes wrong when Ant and build.xml come into play. – StingRay5 Aug 14 '14 at 13:02
  • "I saw that the value was replaced successfully, but somehow it is read as an integer", if you decompile you see "\ xxx" ? I have found this http://stackoverflow.com/questions/8077565/trouble-using-replaceregexp-when-replacing-string-dir-location, using replace rather than replaceregexp – mromer Aug 14 '14 at 13:22