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 equals the library's internal placeholder "com.amitshekhar.debug.DebugDBInitProvider", meaning the ${applicationId} manifest placeholder was never substituted. The library treats this as proof that applicationId is missing from the application's build.gradle and fails fast with a descriptive message.
Solutions
- Add applicationId to app/build.gradle: defaultConfig { applicationId "com.example.myapp" }.
- Check product flavors/buildTypes are not resetting or clearing applicationId.
- Ensure any manually declared <provider> uses android:authorities="${applicationId}.DebugDBInitProvider".
- Verify substitution in the merged manifest under app/build/intermediates/merged_manifests.
- Re-sync Gradle and rebuild after config changes.
Example fix
// before (app/build.gradle)
android {
defaultConfig {
minSdkVersion 16
// no applicationId
}
}
// after
android {
defaultConfig {
applicationId "com.example.myapp"
minSdkVersion 16
}
} Defensive patterns
Strategy: validation
Validate before calling
// Build-time guard that the placeholder will be substituted
afterEvaluate {
if (!android.defaultConfig.hasProperty('applicationId') || !android.defaultConfig.applicationId) {
throw new GradleException("Missing applicationId: DebugDBInitProvider authority placeholder cannot resolve")
}
} Try / catch
try {
DebugDBInitialize.init(application);
} catch (IllegalStateException e) {
throw new RuntimeException("Set applicationId in app/build.gradle defaultConfig to fix DebugDBInitProvider authority", e);
} Prevention
- Set defaultConfig.applicationId in every app module and flavor.
- Never hardcode com.amitshekhar.debug.DebugDBInitProvider as an authority in your manifest.
- Add a CI check that the merged manifest authorities contain your applicationId prefix.
- Sync Gradle and rebuild after modifying build.gradle so placeholders are regenerated.
When it happens
Trigger: The app module's build.gradle lacks defaultConfig.applicationId (or a flavor overrides it away), so the library's <provider android:authorities="${applicationId}.DebugDBInitProvider"> placeholder is not replaced during manifest merge and the raw internal authority reaches attachInfo.
Common situations: Fresh or migrated Android projects missing applicationId; flavors where applicationId was cleared; hand-copied provider declarations using the literal library authority; CI environments building a flavor whose Gradle config is incomplete.
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/1a53289a5c9963b4.
Report an issue: GitHub.
Appendix: source
Thrown at debug-db/src/main/java/com/amitshekhar/debug/DebugDBInitProvider.java:80
@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("DebugDBInitProvider ProviderInfo cannot be null.");
}
// So if the authorities equal the library internal ones, the developer forgot to set his applicationId
if ("com.amitshekhar.debug.DebugDBInitProvider".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)