Skip to content

Android Resource Naming Conflict: StallionProjectId and StallionAppToken #117

@Athul-Raj

Description

@Athul-Raj

Description:

The Stallion Android SDK requires PascalCase string resource names (StallionProjectId and StallionAppToken) in strings.xml, which conflicts with Android's standard naming convention requiring lowercase identifiers (a-z0-9_).

Current Documentation:

The installation guide shows:

<resources>
  <string name="StallionProjectId">66ed03380eb95c9c316256d3</string>
  <string name="StallionAppToken">spb_FTLx5umZ...</string>
</resources>

The Problem:

Android best practices and linting tools flag PascalCase resource names as violations
Some teams have strict AAPT configurations that may enforce lowercase-only naming
This creates inconsistency with other resources in the project

Attempted Workaround (didn't work):

<!-- strings.xml -->
<string name="stallion_project_id">66ed03380eb95c9c316256d3</string>
<string name="stallion_app_token">spb_FTLx5umZ...</string>
<!-- AndroidManifest.xml -->
<meta-data android:name="StallionProjectId" android:value="@string/stallion_project_id" />
<meta-data android:name="StallionAppToken" android:value="@string/stallion_app_token" />

The SDK doesn't read from manifest meta-data, only directly from string resources.

Current Working Solution:

Using PascalCase names directly (works but triggers linting warnings):

<string name="StallionProjectId">@string/STALLION_OTA_PROJECT_ID</string>
<string name="StallionAppToken">@string/STALLION_OTA_APP_TOKEN</string>

Suggested Fix:

Update the SDK to support either:

Option A (Backward Compatible):
Read from manifest meta-data if present, fall back to string resources

// Check manifest first
val projectId = context.packageManager
    .getApplicationInfo(context.packageName, PackageManager.GET_META_DATA)
    .metaData?.getString("StallionProjectId")
    ?: context.getString(R.string.stallion_project_id) // Fallback to lowercase resource

Option B (Simpler):
Only support lowercase resource names and update documentation

// SDK reads from lowercase resources
context.getString(R.string.stallion_project_id)
context.getString(R.string.stallion_app_token)

Both approaches would align with Android conventions while maintaining developer experience.

Environment:

Stallion SDK version: [2.3.2]
React Native: 0.77
Build tool: Gradle 8.x
Target SDK: 34

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions