Macrobenchmark 抛出 INSTALL_FAILED_UPDATE_INCOMPATIBLE

问题描述 投票:0回答:1

我们想要衡量我们的(多模块)应用程序性能。我设置了宏基准,但它没有启动。当我尝试启动基准测试时,它会抛出以下消息:

Failed to install APK(s): /*****.apk
INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.*** signatures do not match previously installed version; ignoring!
com.android.ddmlib.InstallException: INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.*** signatures do not match previously installed version; ignoring!

基准模块构建gradle:

   buildTypes {
    // This benchmark buildType is used for benchmarking, and should function like your
    // release build (for example, with minification on). It"s signed with a debug key
    // for easy local/CI testing.
    create("benchmark") {
        isDebuggable = false
        signingConfig = signingConfigs.getByName("debug")
        matchingFallbacks += listOf("debug")
    }
   }

...

   dependencies {
       implementation("androidx.test.ext:junit:1.1.5")
       implementation("androidx.test.espresso:espresso-core:3.5.1")
       implementation("androidx.test.uiautomator:uiautomator:2.2.0")
       implementation("androidx.benchmark:benchmark-macro-junit4:1.2.0-alpha09")
   }

应用程序模块 gradle 的基准变体:

   create("benchmark") {
        val releaseForInitWith = getByName("debug") {
            isMinifyEnabled = false
            isShrinkResources = false
            proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
        }

        initWith(releaseForInitWith)

        signingConfig = signingConfigs.getByName("debug")
        matchingFallbacks += listOf("debug")
        isDebuggable = false
   }

你能帮忙吗,我该如何解决这个问题?

android kotlin android-gradle-plugin build.gradle macrobenchmark
1个回答
0
投票

INSTALL_FAILED_UPDATE_INCOMPATIBLE:软件包 com.*** 签名与以前安装的版本不匹配;无视!

当设备安装了使用不同证书签名的应用程序版本时,就会发生这种情况。这可能是从 Play 商店安装的版本,也可能是未使用用于您的

signingConfig
构建的
benchmark
签名的版本。在这种情况下,
signingConfig = signingConfigs.getByName("debug")

解决此问题的最简单方法是执行

adb uninstall $appPackage
,然后再次运行基准测试。

© www.soinside.com 2019 - 2024. All rights reserved.