Andorid: Installation failed due to invalid APK file due to version mismatch

I recently upgraded Gradle, created a new project, and ran it in the simulator, only to find an error that could not be installed.
Installation failed due to invalid APK file
Check the LogCat log and get the error message from the Couldn’t Load memtrack Module.
The simulator is 8.0-API-26 and the gradle configuration is

    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "my.study"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

By comparison, I found that api-28 corresponds to an android9 system, while my emulator is an android8 system. The mismatch here leads to the failure of installation.
Modify targetSdkVersion=26 in Gradle configuration

    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "my.study"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

Problem solving.

Read More: