我的SDK中包含以下代码:
public MatchDomainTrustManager(String domain) throws GeneralSecurityException, AssertionError {
if (domain == null) throw new IllegalArgumentException("domain can not be null");
this.domain = domain;
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init((KeyStore) null); //This is where the error thrown
defaultTrustManager = findX509TrustManager(tmf);
if (defaultTrustManager == null) {
throw new IllegalStateException("Couldn't find X509TrustManager");
}
List<X509Certificate> allIssuers = new ArrayList<>();
for (X509Certificate cert : defaultTrustManager.getAcceptedIssuers()) {
allIssuers.add(cert);
}
acceptedIssuers = allIssuers.toArray(new X509Certificate[allIssuers.size()]);
}
在crashlytics中,我看到以下错误:
Fatal Exception: java.lang.NoSuchMethodError
No static method z}ey??Hٲ?e!Σt s;o?+??rʇ,Ԯڧ?^휜ƀ|ڞߵEE?AU粴&}l3 㬻4?Ӊ*ϩH6<0ۙ '^$T܈ưdž♧??Ԉgʯ1%;/C!Q̨Ljava/lang/String;)Ljavax/net/ssl/TrustManagerFactory; in class Ljavax/net/ssl/TrustManagerFactory; or its super classes (declaration of 'javax.net.ssl.TrustManagerFactory' appears in /system/framework/core-oj.jar)
com.tawkon.data.lib.ssl.MatchDomainTrustManager.<init> (MatchDomainTrustManager.java:39)
com.tawkon.data.lib.helper.ServerHelper.?͞rƹ!w?#?X QB?Aퟶ?،̡ݽɗόt1R:鏡"Ѫ⡦EE摶Ƴ (ServerHelper.java:459)
com.tawkon.data.lib.helper.ServerHelper.getDataLibConfiguration (ServerHelper.java:88)
com.tawkon.data.lib.jobScheduler.jobService.RemoteConfigurationJobService$1.run (RemoteConfigurationJobService.java:44)
java.lang.Thread.run (Thread.java:764)
如您所见,我有一个奇怪的乱码错误,我不知道它来自哪里?以前有没有人处理过类似的事情?
设备规格为具有OS 8的三星手机。
这是一个奇怪的例外,因为该应用程序在从OS 4到OS 9的许多不同设备上运行,并且我不能因为任何原因而认为TrustManagerFactory方法会丢失,除非它是操作系统的某些自定义ROM。