react-native-keychain icon indicating copy to clipboard operation
react-native-keychain copied to clipboard

Android release build failing: Test testDowngradeBiometricToAes_api28 FAILED

Open aDavidaIsNoOne opened this issue 5 years ago • 6 comments

We use a build agent that runs on Ubuntu 1604. My local builds on Windows run fine, but for some reason the unit tests for your package are being run there and are failing.

Test testGetSecurityLevel_NoBiometry_api28 PASSED (13s)
  Test testExtractAesCbc_NoFingerprintConfigured_api23 PASSED (9.2s)
  Test testGetSecurityLevel_NoBiometry_NoSecuredHardware_api28 PASSED
  Test testExtractRsaEcb_EnabledFingerprint_api23 PASSED
  Test testExtractRsaEcb_EnabledFingerprint_api28 PASSED
  Test testGetSecurityLevel_Unspecified_api19 PASSED (5.9s)
  Test testGetSecurityLevel_Unspecified_api21 PASSED (5.4s)
  Test testGetSecurityLevel_Unspecified_api23 PASSED
  Test testGetSecurityLevel_Unspecified_api28 PASSED
  Test testDowngradeBiometricToAes_api28 FAILED

 org.mockito.exceptions.base.MockitoException: 
  No argument value was captured!
  You might have forgotten to use argument.capture() in verify()...
  ...or you used capture() in stubbing but stubbed method was not called.
  Be aware that it is recommended to use capture() only with verify()
  
  Examples of correct argument capturing:
      ArgumentCaptor<Person> argument = ArgumentCaptor.forClass(Person.class);
      verify(mock).doSomething(argument.capture());
      assertEquals("John", argument.getValue().getName());
      at com.oblador.keychain.KeychainModuleTests.testDowngradeBiometricToAes_api28(KeychainModuleTests.java:464)

build.gradle

    ext {
        minSdkVersion = 19
        targetSdkVersion = 29
        compileSdkVersion = 29
        versionName = getMyVersionName()
        versionCode = getMyVersionCode()
    }

android/app/build.gradle

defaultConfig {
        applicationId "com.my.app"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode rootProject.ext.versionCode
        versionName rootProject.ext.versionName
        multiDexEnabled true

aDavidaIsNoOne avatar Apr 09 '20 04:04 aDavidaIsNoOne

Update: Turns out locally android studio and gradle were only running assemble, not a full build. The build command fails everywhere. :(

aDavidaIsNoOne avatar Apr 09 '20 18:04 aDavidaIsNoOne

I have the same issue (for react-native run-android), but some of the other tests are failing as well. image

this happens only when I try to run it on my phone but it works fine on the iOS & Android emulators.

ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 23
        compileSdkVersion = 28
        targetSdkVersion = 28
        kotlinVersion = "1.3.10"
    }

arjunu avatar May 14 '20 15:05 arjunu

Hi, I am facing the same issue while doing a full build. It works fine while running on the simulator or the device through the studio.

 Task :react-native-keychain:testDebugUnitTest
  Test testGetSecurityLevel_Unspecified_api21 PASSED (6.6s)
  Test testGetSecurityLevel_Unspecified_api23 PASSED
  Test testGetSecurityLevel_Unspecified_api28 PASSED
  Test testDowngradeBiometricToAes_api28 FAILED

build.gradle

buildToolsVersion = "28.0.3"
minSdkVersion = 19
compileSdkVersion = 28
targetSdkVersion = 28

ankitsingh1492 avatar May 20 '20 13:05 ankitsingh1492

We're also seeing this on Ubuntu 18.04.

Here's the whole build output

info Building the app...

> Task :app:stripDebugDebugSymbols UP-TO-DATE
WARNING: Compatible side by side NDK version was not found. Default is 21.0.6113669.
Compatible side by side NDK version was not found. Default is 21.0.6113669.

> Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
                 Welcome to React Native!
                Learn once, write anywhere


info Writing bundle output to:, /home/ben/myapp/android/app/build/generated/assets/react/release/index.android.bundle
info Writing sourcemap output to:, /home/ben/myapp/android/app/build/generated/sourcemaps/react/release/index.android.bundle.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 53 asset files
info Done copying assets

> Task :react-native-keychain:testDebugUnitTest

com.oblador.keychain.KeychainModuleTests

  Test testGetSecurityLevel_NoBiometry_api28 PASSED (8.2s)
  Test testExtractAesCbc_NoFingerprintConfigured_api23 PASSED (5.2s)
  Test testGetSecurityLevel_NoBiometry_NoSecuredHardware_api28 PASSEDLE
  Test testExtractRsaEcb_EnabledFingerprint_api23 FAILED

  java.lang.AssertionError: tDebugUnitTest > 3 tests completed
  Expected: is <true>
       but: was <false>
      at com.oblador.keychain.KeychainModuleTests.testExtractRsaEcb_EnabledFingerprint_api23(KeychainModuleTests.java:255)

  Test testExtractRsaEcb_EnabledFingerprint_api28 PASSED
  Test testGetSecurityLevel_Unspecified_api19 PASSED (2.5s)
  Test testGetSecurityLevel_Unspecified_api21 PASSED (2.3s)
  Test testGetSecurityLevel_Unspecified_api23 PASSED
  Test testGetSecurityLevel_Unspecified_api28 PASSED
  Test testDowngradeBiometricToAes_api28 FAILED

  org.mockito.exceptions.base.MockitoException: ests completed,
  No argument value was captured!
  You might have forgotten to use argument.capture() in verify()...
  ...or you used capture() in stubbing but stubbed method was not called.
  Be aware that it is recommended to use capture() only with verify()

  Examples of correct argument capturing:
      ArgumentCaptor<Person> argument = ArgumentCaptor.forClass(Person.class);
      verify(mock).doSomething(argument.capture());
      assertEquals("John", argument.getValue().getName());
      at com.oblador.keychain.KeychainModuleTests.testDowngradeBiometricToAes_api28(KeychainModuleTests.java:464)

  Test testFingerprintNoHardware_api21 PASSED
  Test testExtractFacebookConceal_NoHardware_api19 PASSED
  Test testFingerprintAvailableButNotConfigured_api23 PASSED
  Test testMigrateStorageFromOlder_api23 PASSED
  Test testFingerprintConfigured_api23 FAILED

  java.lang.AssertionError:
  Expected: is <true>
       but: was <false>
      at com.oblador.keychain.KeychainModuleTests.testFingerprintConfigured_api23(KeychainModuleTests.java:166)

  Test testFingerprintConfigured_api28 PASSED

com.oblador.keychain.cipherStorage.CipherStorageKeystoreAesCbcTestsIDLE
> IDLE
  Test testGetSecurityLevel_api23 PASSED

com.oblador.keychain.cipherStorage.CipherStorageKeystoreRsaEcbTests

  Test testVerifySecureHardwareAvailability_api28 PASSED
  Test testGetSecurityLevel_api23 PASSED

FAILURE: Executed 19 tests in 20.9s (3 failed)


19 tests completed, 3 failed

> Task :react-native-keychain:testDebugUnitTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-keychain:testDebugUnitTest'.

benmurden avatar Oct 16 '20 06:10 benmurden

Add

project(':react-native-keychain').tasks.withType(Test) {
    enabled = false
}

at the bottom of android/build.gradle as a workaround.

jp928 avatar Nov 18 '20 04:11 jp928

ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 23
        compileSdkVersion = 28
        targetSdkVersion = 28
        kotlinVersion = "1.3.10"
    }

I believe with latest react-native-keychain you need SdkVersions to be 29

Dror-Bar avatar Nov 21 '21 14:11 Dror-Bar