Test running failed:
Permission Denial: starting instrumentation ComponentInfo{com.xxx.taskmanager.warehouse.tests/android.test.InstrumentationTestRunner} from pid=766, uid=766 not allowed because package com.xxx.taskmanager.warehouse.tests does not have a signature matching the target com.xxx.taskmanager.warehouse
Empty test suite.
This is my app.gradle
file
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
}
I think this error is happening because I have not declared the signingConfigs
for test package. If so , how do I declare it. ?
Please help!!
I have solved the issue. Answering it so that it can be useful for someone else.
Solution is for Android Studio :
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With