Invalid app Reference?

You need the application ID to be in the foreign application array of the transaction.