首页 > 解决方案 > Android Studio 3.2 - Instant Run 执行了完整的构建和安装,因为设备上的安装与磁盘上的本地构建不匹配

问题描述

我正在按照 youtube 上的本教程学习制作 android 键盘。我按照其中的描述进行了所有操作。我能够成功构建项目,但每当我尝试运行它时,我都会收到以下错误 -

Instant Run 执行了完整的构建和安装,因为设备上的安装与磁盘上的本地构建不匹配

所以我搜索了一个解决方案并尝试关闭 Instant Run,然后没有出现上述错误。APK 已安装到我的设备上,但是当我尝试在设置中启用键盘时,却找不到它。我在设备和 2 个模拟器中尝试过,但问题到处都是。

我不知道该怎么办。我将复制我的 Android 清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tomsapp.keeskeyboard">

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <service
        android:name=".KeesKeyboard"
        android:label="@string/app_name"
        android:permission="android:permission.BIND_INPUT_METHOD">

        <meta-data android:name="android.view.im" android:resource="@xml/method"/>
        <intent-filter>
            <action android:name="android.view.InputMethod"/>
        </intent-filter>
    </service>
</application>

并在此处构建 Gradle 文件:

apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
    applicationId "com.tomsapp.keeskeyboard"
    minSdkVersion 15
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

请指出我在这里做错了什么。

标签: androidandroid-studio

解决方案


在您的 build.Gradle 文件中,将 minSDK 设置为 22n,使其与您的 android 虚拟设备匹配。


推荐阅读