Elye
Elye

Reputation: 60141

ManifestPlaceholder convert NumericString to actual number?

I'm using ManifestPlaceholder to store some Key in my gradle.build, that could be then use in AndroidManifest.xml eventually. It works fine for my Fabric.io key, but not for my Facebook Key.

The reason is, in my Fabric.io key, it contacts numbers and alphabets. So it is preserved as a String. But since the Facebook key is all number (although it's String), it get converted to some other random number.

More clearer illustration below.

As expected if I set the ManifestPlaceholder as below

    manifestPlaceholders = [facebook_app_id: "12345678901234G"]

And in my AndroidManifest.xml as

    <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="${facebook_app_id}" />

I will get my ID retained in generated AndroidManifest.xml

    <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="12345678901234G" />

However if I set something that is fully numeric as below

    manifestPlaceholders = [facebook_app_id: "123456789012345"]

While my AndroidManifest.xml is the same

    <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="${facebook_app_id}" />

It becomes something as below in my generated AndroidManifest.xml.

    <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="1457557760.000000" />

Why did it change my numerical String? How could I preserve it as a String?

Upvotes: 1

Views: 350

Answers (1)

azizbekian
azizbekian

Reputation: 62189

I verify this works as expected with Android gradle plugin 2.3.0 and Gradle plugin version 3.4.1.

enter image description here

Upvotes: 1

Related Questions