{"record":{"id":"d6cf5b1e3290a206","repo":"gradle/gradle","slug":"no-s-library-binary-available-for-library-s-wi","errorCode":null,"errorMessage":"No %s library binary available for library '%s' with [flavor: '%s', platform: '%s', buildType: '%s']","messagePattern":"No (.+?) library binary available for library '(.+?)' with \\[flavor: '(.+?)', platform: '(.+?)', buildType: '(.+?)'\\]","errorType":"exception","errorClass":"LibraryResolveException","httpStatus":null,"severity":"error","filePath":"platforms/native/plugins-model-native/src/main/java/org/gradle/nativeplatform/internal/resolve/DefaultLibraryResolver.java","lineNumber":112,"sourceCode":"        }\n\n        private org.gradle.nativeplatform.NativeLibraryBinary resolve(Set<? extends org.gradle.nativeplatform.NativeLibraryBinary> candidates) {\n            for (org.gradle.nativeplatform.NativeLibraryBinary candidate : candidates) {\n                if (flavor != null && !flavor.getName().equals(candidate.getFlavor().getName())) {\n                    continue;\n                }\n                if (platform != null && !platform.getName().equals(candidate.getTargetPlatform().getName())) {\n                    continue;\n                }\n                if (buildType != null && !buildType.getName().equals(candidate.getBuildType().getName())) {\n                    continue;\n                }\n\n                return candidate;\n            }\n\n            String typeName = GUtil.elvis(requirement.getLinkage(), \"shared\");\n            throw new LibraryResolveException(String.format(\"No %s library binary available for library '%s' with [flavor: '%s', platform: '%s', buildType: '%s']\",\n                    typeName, requirement.getLibraryName(), flavor.getName(), platform.getName(), buildType.getName()));\n        }\n    }\n}\n","sourceCodeStart":94,"sourceCodeEnd":117,"githubUrl":"https://github.com/gradle/gradle/blob/534f27719b66953f95cc907aae7f2c1b12f5482d/platforms/native/plugins-model-native/src/main/java/org/gradle/nativeplatform/internal/resolve/DefaultLibraryResolver.java#L94-L117","documentation":"The required library exists, but LibraryResolution filters its candidate binaries by the requester's flavor, targetPlatform and buildType, and by the class implied by the linkage. If nothing survives filtering, LibraryResolveException is thrown listing the exact dimensions that failed to match, so the message tells you which axis (flavor/platform/buildType/linkage) is misaligned.","triggerScenarios":"A consumer builds for platform X (targetPlatforms 'windows') while the library only produces binaries for its default platform; custom flavors or buildTypes declared on one component but not the library; requiring 'shared' when the library (or prebuilt) only offers a static binary, or vice versa.","commonSituations":"Adding cross-compilation targets to an executable but not to its library dependencies; introducing per-project custom flavors/buildTypes; prebuilt libraries that declare artifacts for only one platform or linkage.","solutions":["Mirror the variant dimensions: give the required library the same targetPlatforms/flavors/buildTypes as the consuming component so a matching binary gets built.","If the library only produces one linkage, request exactly that one (linkage 'static' or 'shared').","Compare the dimensions in the message against the library's declared dimensions using the 'model' report.","For prebuilt libraries, declare binaries (files) for every platform the consumers request, or restrict the consumer's target platforms."],"exampleFix":"// before\nmodel {\n    components {\n        app(NativeExecutableSpec) { targetPlatforms 'linux', 'windows' }\n        util(NativeLibrarySpec) { }   // default platform only -> no 'windows' binary\n    }\n}\n// after\nmodel {\n    components {\n        app(NativeExecutableSpec) { targetPlatforms 'linux', 'windows' }\n        util(NativeLibrarySpec) { targetPlatforms 'linux', 'windows' }\n    }\n}","handlingStrategy":"validation","validationCode":"// Keep variant dimensions aligned: define platforms/flavors once and reuse everywhere\n// build.gradle (shared via apply from: or a convention plugin):\next.nativePlatforms = ['linux', 'windows']\n// then in every component:\n//   targetPlatforms project.ext.nativePlatforms as String[]\n// A library missing any consumer dimension is exactly what produces\n// \"No <linkage> library binary available ... [flavor, platform, buildType]\".","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Define targetPlatforms/flavors/buildTypes in one shared place and apply them to components AND their libraries","When adding cross-compilation to a consumer, add the same target to every library it depends on in the same change","Read the dimensions in the message: they tell you exactly which axis has no matching binary"],"tags":["gradle","native","variant-mismatch","platform","dependency-resolution"],"backgroundTag":"no-matching-variant","analyzedSha":"534f27719b66953f95cc907aae7f2c1b12f5482d","analyzedAt":"2026-08-22T08:09:12.375Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}