That error usually indicates that you may have posted Device Handler code into the My SmartApps page, or SmartApp code into the Device Handler page.
I suggest you have a look at this Community Installer - it does all the dirty work for you, and might resolve your problems quite easily…