首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >测试运行失败:权限拒绝:启动检测工具ComponentInfo

测试运行失败:权限拒绝:启动检测工具ComponentInfo
EN

Stack Overflow用户
提问于 2015-02-22 15:14:51
回答 5查看 7.4K关注 0票数 13

测试运行失败:

权限拒绝:从ComponentInfo{com.xxx.taskmanager.warehouse.tests/android.test.InstrumentationTestRunner}启动检测工具pid=766,uid=766不允许,因为包com.xxx.taskmanager.warehouse.tests没有匹配目标com.xxx.taskmanager.warehouse的签名

空荡荡的测试套件。

这是我的app.gradle文件

代码语言:javascript
运行
复制
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'

android {
    signingConfigs {
        release
        {
            keyAlias 'xxx'
            keyPassword 'xxx'
            storeFile file('../keystore.jks')
            storePassword 'xxx'
        }
    }

    compileSdkVersion 16
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.xxx.taskmanager.warehouse"
        minSdkVersion 16
        targetSdkVersion 16
        versionCode 3
        versionName "3.0"
        testApplicationId "com.xxx.taskmanager.warehouse.tests"
    }

    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'LICENSE'
        exclude 'NOTICE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/ASL2.0'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }

    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            output.outputFile = new File(
                    output.outputFile.parent,
                    "FLO_HANDHELD_V${variant.versionName}.apk"
            )
        }
    }

    variantFilter { variant ->
        if(variant.buildType.name.equals('debug')) {
            variant.setIgnore(true);
        }
    }

    productFlavors {
        production_b2b {
            applicationId "com.xxx.taskmanager.warehouse"
            minSdkVersion 16
            targetSdkVersion 16
            versionCode 3
            versionName "3.1-Prod-B2B"
        }
        stage_b2b {
            applicationId "com.xxx.taskmanager.warehouse"
            minSdkVersion 16
            targetSdkVersion 16
            versionCode 3
            versionName "3.1-Stage-B2B"
        }
        production_b2c {
            applicationId "com.xxx.taskmanager.warehouse"
            minSdkVersion 16
            targetSdkVersion 16
            versionCode 3
            versionName "3.1-Prod-B2C"
        }
        stage_b2c {
            applicationId "com.xxx.taskmanager.warehouse"
            minSdkVersion 16
            targetSdkVersion 16
            versionCode 3
            versionName "3.1-Stage-B2C"
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile files ('libs/android-support-v7-appcompat.jar')
    compile files('libs/android-support-v4.jar')
    compile project(':taskmanagerlib')
    compile files('libs/DataCollection.jar')
    androidTestCompile fileTree(dir: 'libs', include: 'robotium-solo-5.3.0.jar')
}

task copyTask(type: Copy) {
    from 'build/outputs/apk'
    into 'apks'
    exclude '**/*-unaligned.apk'
}

task deleteApk(type: org.gradle.api.tasks.Delete){
    //    delete 'apks'
}

task appBuild(dependsOn: ['deleteApk','clean', 'assembleRelease',       'copyTask']){
    assembleRelease.mustRunAfter deleteApk
    clean.mustRunAfter deleteApk
    copyTask.mustRunAfter assembleRelease
}

我认为发生此错误是因为我没有为测试包声明signingConfigs。如果是的话,我该如何申报。?

救命啊!!

EN

回答 5

Stack Overflow用户

发布于 2015-02-24 05:22:17

我已经解决了这个问题。回答它,这样它就能对别人有用。

解决方案是用于Android:

代码语言:javascript
运行
复制
For the tests to run , the build variant should be debug.   Build Variants window is present in the left side of the android studio, if not activated then activate it by click on Build variants tab present on the left side of the android studio.
票数 14
EN

Stack Overflow用户

发布于 2018-04-11 21:10:09

要么将构建变量更改为debug,要么将testBuildType添加到build.gradle文件中的android标记中。如下所示:

代码语言:javascript
运行
复制
android {
    ...
    testBuildType "release"
}
票数 2
EN

Stack Overflow用户

发布于 2017-05-17 13:24:14

  1. 清理你的项目。
  2. 卸载应用程序,如果已经安装。

现在运行您的项目。

对我来说完全有效。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28659451

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档