amitshekhariitbhu/Android-Debug-Database · error · IllegalStateException
Incorrect provider authority in manifest. Most likely due…
Error message
Incorrect provider authority in manifest. Most likely due to a missing applicationId variable in application's build.gradle.
What it means
attachInfo throws IllegalStateException when providerInfo.authority still equals the library's internal placeholder "com.amitshekhar.debug.encrypt.DebugDBEncryptInitProvider". The library manifest uses a manifest placeholder ${applicationId} for android:authorities; if applicationId is missing or the placeholder is not substituted, the raw internal authority survives manifest merge and the library detects the misconfiguration and throws. It is a deliberate fail-fast guard against a missing applicationId in build.gradle.
Solutions
- Set applicationId in app/build.gradle defaultConfig: defaultConfig { applicationId "com.example.myapp" }.
- Ensure any product flavor or buildType does not clear/override applicationId to an empty or library-like value.
- If you declared the provider manually, change android:authorities to "${applicationId}.DebugDBEncryptInitProvider".
- Inspect the merged manifest (app/build/intermediates/merged_manifests) to confirm the authority was substituted.
- Sync/rebuild the project after editing build.gradle so manifest placeholders regenerate.
Example fix
// before (app/build.gradle)
android {
defaultConfig {
// applicationId missing
}
}
// after
android {
defaultConfig {
applicationId "com.example.myapp"
}
} Defensive patterns
Strategy: validation
Validate before calling
// Validate before/at build time that applicationId exists
// In app/build.gradle, add a check task:
afterEvaluate {
if (!android.defaultConfig.applicationId) {
throw new GradleException("applicationId is required for debug-db-encrypt provider placeholder substitution")
}
} Try / catch
try {
DebugDBEncryptInitialize.init(application);
} catch (IllegalStateException e) {
// Missing applicationId: surface a clear build/config error
throw new RuntimeException("Fix: set applicationId in app/build.gradle defaultConfig", e);
} Prevention
- Always set defaultConfig.applicationId in every app module.
- Use ${applicationId} placeholders (never literal library authorities) in your own provider declarations.
- Grep the merged manifest in CI for the raw string com.amitshekhar.debug.encrypt.DebugDBEncryptInitProvider in android:authorities.
- Re-sync Gradle after any build.gradle edits before running the app.
When it happens
Trigger: Building without setting applicationId in the app module's defaultConfig (or the product flavor overriding it), so the ${applicationId} placeholder in the library's <provider android:authorities> is not replaced and the authority remains com.amitshekhar.debug.encrypt.DebugDBEncryptInitProvider.
Common situations: Newly created modules or WIP apps missing defaultConfig.applicationId; old Gradle/manifest merge behavior; copy-pasting the provider declaration with the literal library authority instead of ${applicationId}; CI builds with a mismatched flavor config.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- Incorrect provider authority in manifest. Most likely due…
- DebugDBEncryptInitProvider ProviderInfo cannot be null.
- DebugDBInitProvider ProviderInfo cannot be null.
AI-assisted analysis of amitshekhariitbhu/Android-Debug-Database@bf149df61f (2026-09-12).
Data as JSON: /api/errors/3813f1c5228b4b5c.
Report an issue: GitHub.
Appendix: source
Thrown at debug-db-encrypt/src/main/java/com/amitshekhar/debug/encrypt/DebugDBEncryptInitProvider.java:57
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
return 0;
}
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
return 0;
}
@Override
public void attachInfo(Context context, ProviderInfo providerInfo) {
if (providerInfo == null) {
throw new NullPointerException("DebugDBEncryptInitProvider ProviderInfo cannot be null.");
}
// So if the authorities equal the library internal ones, the developer forgot to set his applicationId
if ("com.amitshekhar.debug.encrypt.DebugDBEncryptInitProvider".equals(providerInfo.authority)) {
throw new IllegalStateException("Incorrect provider authority in manifest. Most likely due to a "
+ "missing applicationId variable in application\'s build.gradle.");
}
super.attachInfo(context, providerInfo);
}
}
View on GitHub (pinned to bf149df61f)