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

时间:2018-10-07 13:19:45

标签: android android-studio

我正在YouTube上关注此tutorial,以学习制作Android键盘。我遵循其中描述的所有内容。我能够成功构建项目,但是每当我尝试运行它时,我都会收到以下错误-

  

即时运行执行了完整的构建并安装,因为设备上的安装与磁盘上的本地构建不匹配

因此,我搜索了一个解决方案,并尝试关闭了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'
}

请指出我在这里做错了。

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:0)

如果您的应用中有图像视图,则将该图像对应的图像放置在 drawable 文件夹中。不要将其保存在drawable -v24文件夹中,并在您的设备上运行它可能会起作用