IOException: Failed to find byte code when upgrade to Android Studio 3.1
Just as @Malcolm said, this is an Android Studio 3.1 issue.
If you don't want to revert Android Studio 3.1 to 3.0, you can disable Instant Run.
If you don't want to revert Android Studio 3.1 to 3.0, and do need Instant Run, you can edit build.gradle and gradle-wrapper.properties like below:
com.android.tools.build:gradle:3.1.0
-> com.android.tools.build:gradle:3.0.1
distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
-> distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip
There is an issue, which they promise to fix in 3.2. Until then you probably have to roll back to Android Studio 3.0 if you don't want to turn off instant run. Why they don't want to release a hotfix for this, I don't know. Seems to be a pretty important bug.
See:
I suggest voting for the issue, maybe this will motivate them to release the fix sooner.