{"record":{"id":"aa4748e70394822a","repo":"Tencent/matrix","slug":"this-plugin-must-be-applied-after-com-android-lib","errorCode":null,"errorMessage":"This plugin must be applied after \"com.android.library\" plugin","messagePattern":"This plugin must be applied after \"com\\.android\\.library\" plugin","errorType":"console","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/gradle/WeChatArmeabiCompat.gradle","lineNumber":2,"sourceCode":"if (!plugins.hasPlugin('com.android.library'))\n    throw new GradleException('This plugin must be applied after \"com.android.library\" plugin')\n\nandroid.libraryVariants.all { variant ->\n    def srcAbi = 'armeabi-v7a'\n    def targetAbi = 'armeabi'\n    \n    def bundleTask = variant.getPackageLibrary() as Zip\n    def makeCompatAbiTask = project.task(\"makeArmeabiCompatFor${variant.name.capitalize()}\")\n    makeCompatAbiTask.doFirst {\n        bundleTask.inputs.files.files.each { fileIn ->\n            def nameIn = fileIn.name\n            def pathIn = fileIn.absolutePath\n            def srcAbiPathSeg = \"${File.separator}${srcAbi}${File.separator}\"\n            if ((!nameIn.endsWith('.so') && !nameIn.endsWith('.a')) || !pathIn.contains(srcAbiPathSeg)) {\n                return\n            }\n\n            def targetAbiPathSeg = \"${File.separator}${targetAbi}${File.separator}\"\n            def targetAbiPathIn = pathIn.replace(srcAbiPathSeg, targetAbiPathSeg)","sourceCodeStart":1,"sourceCodeEnd":20,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/gradle/WeChatArmeabiCompat.gradle#L1-L20","documentation":"WeChatArmeabiCompat.gradle is a helper Gradle script that rewrites armeabi-v7a native libs to armeabi; it requires the Android library plugin to already be applied. It throws a GradleException at script-apply time if plugins.hasPlugin('com.android.library') is false.","triggerScenarios":"Applying the script in a com.android.application module, in a pure Java/Kotlin module, or applying it before 'com.android.library' in the plugin declaration order of the same build script.","commonSituations":"Copy-pasting the script into an app module's build.gradle; applying via 'apply from:' before the library plugin is loaded; using it in a legacy project where the module uses the app plugin.","solutions":["Apply the script only in modules that use 'com.android.library'","Ensure 'apply plugin: com.android.library' comes BEFORE 'apply from: WeChatArmeabiCompat.gradle' in the same script","Remove the script from application modules; adapt it (libraryVariants -> applicationVariants) if needed for apps"],"exampleFix":"// before\napply from: 'WeChatArmeabiCompat.gradle'\napply plugin: 'com.android.library'\n// after\napply plugin: 'com.android.library'\napply from: 'WeChatArmeabiCompat.gradle'","handlingStrategy":"validation","validationCode":"// build.gradle\nassert plugins.hasPlugin('com.android.library') : 'WeChatArmeabiCompat requires library plugin'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Apply Android plugins before helper scripts","Keep helper scripts only in library modules","Verify plugin application order in code review"],"tags":["gradle","android","plugin-order","build-script"],"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"}