{"record":{"id":"3813f1c5228b4b5c","repo":"amitshekhariitbhu/Android-Debug-Database","slug":"incorrect-provider-authority-in-manifest-most-likely-due-to","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-encrypt/src/main/java/com/amitshekhar/debug/encrypt/DebugDBEncryptInitProvider.java","lineNumber":57,"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(\"DebugDBEncryptInitProvider 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.encrypt.DebugDBEncryptInitProvider\".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":39,"sourceCodeEnd":64,"githubUrl":"https://github.com/amitshekhariitbhu/Android-Debug-Database/blob/bf149df61f03e7191f0a0cc71dfb2352f91173b2/debug-db-encrypt/src/main/java/com/amitshekhar/debug/encrypt/DebugDBEncryptInitProvider.java#L39-L64","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (app/build.gradle)\nandroid {\n    defaultConfig {\n        // applicationId missing\n    }\n}\n\n// after\nandroid {\n    defaultConfig {\n        applicationId \"com.example.myapp\"\n    }\n}","handlingStrategy":"validation","validationCode":"// Validate before/at build time that applicationId exists\n// In app/build.gradle, add a check task:\nafterEvaluate {\n    if (!android.defaultConfig.applicationId) {\n        throw new GradleException(\"applicationId is required for debug-db-encrypt provider placeholder substitution\")\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    DebugDBEncryptInitialize.init(application);\n} catch (IllegalStateException e) {\n    // Missing applicationId: surface a clear build/config error\n    throw new RuntimeException(\"Fix: set applicationId in app/build.gradle defaultConfig\", e);\n}","preventionTips":["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."],"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"}