Andy can't "quit"
Andy is Dave's lawyer and this is a position that one cannot just "quit".
In general, defence lawyers would prefer to have upstanding human beings who are innocent of the crime but, bye-and-large, those people don't get charged with a crime. It is an established fact that most crimes are committed by criminals. Defending guilty people is most of what defence lawyers do.
If Andy is not yet Dave's lawyer then, if Andy is in private practice, he doesn't have to take the job. If Andy is a public defendant or a court-appointed representative then Andy doesn't even have that choice.
Either way, once Andy is Dave's lawyer then, beyond a certain point in the trial, he is Dave's lawyer for the duration of the case barring extraordinary circumstances (like Andy dying or becoming gravely ill). If Andy wants to "Quit" or Dave wants to "fire" Andy, they must get the permission of the court and it will only be given for a very good reason. Dave being "a repulsive human being who's obviously guilty of the crime" is not such a reason - Dave is entitled to representation and Andy is it.
Andy can't throw the trial
Andy must represent Dave to the best of Andy's ability, personal feelings notwithstanding. Failing to do so can lead to Andy being disciplined and ultimately no longer being a lawyer.
At the same time, Andy can't deceive the court or allow the court to be deceived. This will restrict the strategies that Andy can use in Dave's defence but that's just how it is.
Please note that there is a huge difference between, say, killing someone and murdering them. It is not enough for the prosecution to prove that Dave killed the victim - that may even be uncontested; they have to prove that the killing was unlawful and intentional as well.
Andy can't reveal what he knows
Everything that Andy learns while he is Dave's lawyer is subject to attorney-client privilege. That is, it's a secret that only Dave is allowed to break - if Andy does so then he's on the road to no longer being a lawyer.
In any event, anything that is subject to privilege can't be used in court unless Dave agrees to it being used.