Plugin Activation Error – The plugin generated 22 characters of unexpected output during activation

As @Rup has said in a plugin PHP file you should not have any HTML or any characters at all outside of the PHP opening and closing tags <?php and ?>.

It’s possible sometimes that you have invisible whitespace before or after these tags which can generate this error. One workaround (also as @Rup says) is to makesure your PHP is valid and leave off the closing ?> PHP tag which helps with whitespace at the end of the while.

Adding answer for reference to others with this issue