Environment:
- Android Studio
- hwid: 5.2.0.300
- CI
Problem Describe:
After we integrate latest Huawei SDK, our CI failed since Android Test is not pass.
And we dig into the report a bit, it gives us this error in stack trace:
org.bouncycastle.pqc.crypto.qtesla.QTeslaKeyEncodingTests > testDecodeEncodePublicKeyQT3P[V1836A - 10] FAILED
java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java:78)
org.bouncycastle.pqc.crypto.qtesla.QTeslaKeyEncodingTests > testDecodeEncodePrivateKeyQT3P[V1836A - 10] FAILED
java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java:78)
Which this error is introduced by com.huawei.hms:hwid:5.2.0.300
.
So no doubt, if you integrate hwid:5.2.0.300
, it will fail your unit test along with your CI/CD.
Problem Reason:
After we look deeper, huawei SDK introduced org.bouncycastle:bcpkix-jdk15on:1.64
as dependence, which in this version, they include unit test to their library by mistake, and it fixed in 1.65
.
Check https://github.com/bcgit/bc-java/issues/661
So I kindly ask Huawei upgrade org.bouncycastle:bcpkix-jdk15on
to 1.65
or above in your dependence. It's one-job if you have the code base.
Hack Solution:
In order to make our CI work as expected, now we are doing this, if anyone else has the same issue:
dependencies {
// ......... something else what we need
huaweiApi ('com.huawei.hms:hwid:5.2.0.300') {
// Huawei include org.bouncycastle 1.64 version
// In this version, the source code include unit test file in library, which will cause our CI Fail.
exclude group: 'org.bouncycastle', module: "bcprov-jdk15on"
}
huaweiApi 'org.bouncycastle:bcpkix-jdk15on:1.65'
}