{"record":{"id":"1a53289a5c9963b4","repo":"amitshekhariitbhu/Android-Debug-Database","slug":"incorrect-provider-authority-in-manifest-most-likely-due-to-1a5328","errorCode":null,"errorMessage":"Incorrect provider authority in manifest. Most likely due to a missing applicationId variable in application's build.gradle.","messagePattern":"Incorrect provider authority in manifest\\. Most likely due to a missing applicationId variable in application's build\\.gradle\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"debug-db/src/main/java/com/amitshekhar/debug/DebugDBInitProvider.java","lineNumber":80,"sourceCode":"\n    @Override\n    public int delete(Uri uri, String selection, String[] selectionArgs) {\n        return 0;\n    }\n\n    @Override\n    public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {\n        return 0;\n    }\n\n    @Override\n    public void attachInfo(Context context, ProviderInfo providerInfo) {\n        if (providerInfo == null) {\n            throw new NullPointerException(\"DebugDBInitProvider ProviderInfo cannot be null.\");\n        }\n        // So if the authorities equal the library internal ones, the developer forgot to set his applicationId\n        if (\"com.amitshekhar.debug.DebugDBInitProvider\".equals(providerInfo.authority)) {\n            throw new IllegalStateException(\"Incorrect provider authority in manifest. Most likely due to a \"\n                    + \"missing applicationId variable in application\\'s build.gradle.\");\n        }\n        super.attachInfo(context, providerInfo);\n    }\n\n}\n","sourceCodeStart":62,"sourceCodeEnd":87,"githubUrl":"https://github.com/amitshekhariitbhu/Android-Debug-Database/blob/bf149df61f03e7191f0a0cc71dfb2352f91173b2/debug-db/src/main/java/com/amitshekhar/debug/DebugDBInitProvider.java#L62-L87","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (app/build.gradle)\nandroid {\n    defaultConfig {\n        minSdkVersion 16\n        // no applicationId\n    }\n}\n\n// after\nandroid {\n    defaultConfig {\n        applicationId \"com.example.myapp\"\n        minSdkVersion 16\n    }\n}","handlingStrategy":"validation","validationCode":"// Build-time guard that the placeholder will be substituted\nafterEvaluate {\n    if (!android.defaultConfig.hasProperty('applicationId') || !android.defaultConfig.applicationId) {\n        throw new GradleException(\"Missing applicationId: DebugDBInitProvider authority placeholder cannot resolve\")\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    DebugDBInitialize.init(application);\n} catch (IllegalStateException e) {\n    throw new RuntimeException(\"Set applicationId in app/build.gradle defaultConfig to fix DebugDBInitProvider authority\", e);\n}","preventionTips":["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."],"tags":["android","gradle","manifest","applicationid","content-provider"],"backgroundTag":"missing-required-config-field","analyzedSha":"bf149df61f03e7191f0a0cc71dfb2352f91173b2","analyzedAt":"2026-09-12T15:02:14.977Z","contentChangedAt":"2026-09-12T15:02:14.977Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}