{"record":{"id":"eed309fa3e4f7013","repo":"Tencent/matrix","slug":"either-android-app-plugin-id-or-android-l","errorCode":null,"errorMessage":"[-] Either ${ANDROID_APP_PLUGIN_ID} or ${ANDROID_LIB_PLUGIN_ID} should be applied when use this script.","messagePattern":"\\[-\\] Either (.+?) or (.+?) should be applied when use this script\\.","errorType":"console","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/gradle/WeChatNativeDepend.gradle","lineNumber":115,"sourceCode":"\n    def moveToDir(String path) {\n        moveToDirPath = Objects.requireNonNull(path)\n    }\n}\n\n//////////////////////////////////////////////////////////////\n\n\n//////////////////////////////////////////////////////////////\n//  Entry Codes\n//////////////////////////////////////////////////////////////\n\nif (project.pluginManager.hasPlugin(ANDROID_APP_PLUGIN_ID)) {\n    handleAndroidApplication()\n} else if (project.pluginManager.hasPlugin(ANDROID_LIB_PLUGIN_ID)) {\n    handleAndroidLibrary()\n} else {\n    throw new GradleException(\"[-] Either ${ANDROID_APP_PLUGIN_ID} or ${ANDROID_LIB_PLUGIN_ID} \"\n            + \"should be applied when use this script.\")\n}\n\n//////////////////////////////////////////////////////////////\n\n\n//////////////////////////////////////////////////////////////\n//  Helper Methods\n//////////////////////////////////////////////////////////////\ndef cleanDirectory(File dir) {\n    if (dir.isDirectory()) {\n        dir.deleteDir()\n        dir.mkdirs()\n    }\n}\n\ndef getGenerateOpsAnchorTask(variant) {\n    final List<String> startTaskNames = gradle.startParameter.taskNames","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/gradle/WeChatNativeDepend.gradle#L97-L133","documentation":"WeChatNativeDepend.gradle customizes native dependency handling and supports two modes depending on the applied Android plugin: application or library. If neither the app nor the library plugin is applied to the project, it throws a GradleException naming both required plugin IDs.","triggerScenarios":"Applying the script in a module without any Android plugin (plain java-library, Kotlin JVM, or the root build.gradle), or applying it before either Android plugin is registered on the project.","commonSituations":"Adding the script to the root project instead of an Android module; applying from a non-Android subproject; plugin-application order issues in legacy apply-from setups.","solutions":["Apply the script only in modules that apply 'com.android.application' or 'com.android.library'","Ensure the Android plugin is applied before 'apply from: WeChatNativeDepend.gradle'","Remove the script from the root project or non-Android modules"],"exampleFix":"// before\n// root build.gradle\napply from: 'WeChatNativeDepend.gradle'\n// after\n// app/build.gradle\napply plugin: 'com.android.application'\napply from: '../WeChatNativeDepend.gradle'","handlingStrategy":"validation","validationCode":"// in module build.gradle, before apply from:\nassert plugins.hasPlugin('com.android.application') || plugins.hasPlugin('com.android.library')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Apply the script only inside Android application/library modules","Apply the Android plugin before the helper script","Never apply at the root project level"],"tags":["gradle","android","plugin","build-script","missing-plugin"],"backgroundTag":"missing-dependency","analyzedSha":"3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7","analyzedAt":"2026-09-08T08:01:39.722Z","contentChangedAt":"2026-09-08T08:01:39.722Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}