The code triggering the error resides in MergeNativeLibsTask.kt:
/**
* [file] is one of these two kinds:
* (1) /path/to/{x86/lib.so}
* (2) /path/to/x86/{lib.so}
* Where the value in {braces} is the [relativePath] from the file visitor.
* The first (1) is from tasks that process all ABIs in a single task.
* The second (2) is from tasks the where each task processes one ABI.
*
* This function distinguishes the two cases and returns a relative path that always
* starts with an ABI. So, for example, both of the cases above would return:
*
* x86/lib.so
*
*/
private fun toAbiRootedPath(file : File, relativePath: RelativePath) : String {
return if (abiTags.any { it == relativePath.segments[0] }) {
// Case (1) the relative path starts with an ABI name. Return it directly.
relativePath.pathString
} else {
// Case (2) the relative path does not start with an ABI name. Prepend the
// ABI name from the end of [file] after [relativePath] has been removed.
var root = file
repeat(relativePath.segments.size) { root = root.parentFile }
val abi = root.name
if (!abiTags.any { it == abi }) {
error("$abi extracted from path $file is not an ABI")
}
abi + separatorChar + relativePath.pathString
}
}
Based on the fact that your error starts with "jni", it appears that in your case, it picks the "jni" part of the path as the extracted ABI.
The code really looks like it requires a supported ABI name to be either the first segment of the relative path, or the name of the directory just outside of the relative path.
In your case, I surmise that you have a file value of /Users/user01/.gradle/caches/transforms-3/4445827a66e5ef9b85054fadb96c8209/transformed/jetified-armnn.delegate-23.05/jni/arm64-v8.2-a/libarmnn_delegate_jni.so
and a relativePath arm64-v8.2-a/libarmnn_delegate_jni.so
.
- The first ("case 1") check will try to match "arm64-v8.2-a" with a known ABI, which apparently fails.
- In the else path, we find the root by jumping upward two times (the number of elements in the relativePath), ending up with
/Users/user01/.gradle/caches/transforms-3/4445827a66e5ef9b85054fadb96c8209/transformed/jetified-armnn.delegate-23.05/jni
. The name of that dir is "jni", which also does not match any known ABI. Hence, the error.
I don't see any way to make this function pass except to make sure it is not called at all for this file. If that's possible, I don't know how (but I'm certainly no expert in the area). The other option is to remove the "bad" ABI from the dependency (if you have control over it) -- the list of accepted ones should be here.
This has previously been reported as a bug on the Google Issue Tracker, but there doesn't appear to be much (public) progress. Please do not post in those comments if you don't have anything new to add; mark the issue with the star icon or "+1" button instead.