There are about a million ways that solution import validation can throw errors like this, so it is very hard to give you a clear answer, but I can tell you one mistake I've made before that resulted in a similar error:
When you get a "both must be managed" error, this is not necessarily referring to the solutions, but may be referring to individual solution components and the solutions they came from in their source environment. Yeah, I know that's a bit weird, but stick with me and I'll explain... So let's say that your problem solution here has component X (let's call it a Table) as Managed with no managed source solution dependency because you built table X in the unmanaged layer in the Source environment, but your Destination env might have Table X already from a different managed solution (i.e. you already imported a different managed solution that also includes Table X).
I agree the wording of the error message is very confusing, but what it's trying to tell you is that in the Target env Table X was originally imported in a Managed Solution (and carries that dependency), whereas in your Source env, that Table was built in an Unmanaged layer, then packaged in this different Managed Solution. Dataverse is trying to stop you from doing something silly and importing a solution that could cause unexpected complications in a managed solution already in place.
Unfortunately, this can sometimes happen for totally benign reasons like, "this is just a different Managed Sol from the same Source" and that can cause a lot of headaches.
Luckily, this issue has an easy fix (sometimes). If you are certain that importing this other copy is safe, you can just manually edit the solution.xml in the zip file to either remove the dependency reference or insert a matching managed solution id to trick your Target env into thinking that they match. Dataverse only does this validation during initial import and not during the actual installation of components, so by tricking the solution.xml reference, you can bypass the check... But don't do this if you aren't TOTALLY sure the two solutions will play nicely together.