2

我正在使用 unirest 来获得 camfind 结果。

完整的错误日志:

04-14 18:24:39.574    1880-2300/projectco.project E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-120
Process: projectco.project, PID: 1880
java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/naming/ldap/LdapName;
        at com.mashape.relocation.conn.ssl.AbstractVerifier.extractCNs(AbstractVerifier.java:277)
        at com.mashape.relocation.conn.ssl.AbstractVerifier.getCNs(AbstractVerifier.java:265)
        at com.mashape.relocation.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:157)
        at com.mashape.relocation.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:140)

[...] 更多“在”

at bookshotco.bookshot2.MainActivity$1.run(MainActivity.java:100)
        at java.lang.Thread.run(Thread.java:818)
 Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.naming.ldap.LdapName" on path: DexPathList[[zip file "/data/app/projectco.project-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

[..]

Suppressed: java.lang.ClassNotFoundException: javax.naming.ldap.LdapName
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 23 more
 Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

很少有人遇到这个问题,解决它的人更少,大多数时候使用的东西与不同版本的兼容性有关,这对我不起作用。

我使用的模拟器是最新的(api 21 上的nexus 5)。

4

2 回答 2

5

我最近遇到了同样的问题,它只发生在混淆代码中。因此,将整个 org.apache 包保留在 Proguard 规则中解决了这个问题。

# Keep Apache Package, since it cannot find some of the classes and throws Verify Error
-keep class org.apache.** {*;}
于 2015-09-30T22:10:33.223 回答
0

此错误也可能是由于在连接到远程服务器时需要 ssl(即“useSSL”)并且没有如下定义的 verifyServerCertificate 和 trustServerCertificate 以及没有正确定义服务器证书而导致的。系统正在尝试使用 LDAP 身份验证过程,因此出现错误。

val info = Properties()
info.setProperty("useSSL", "true")
info.setProperty("requireSSL", "true")
info.setProperty("user", user)
info.setProperty("password", password)
info.setProperty("verifyServerCertificate", "false")
info.setProperty("trustServerCertificate", "true")

此外,如果您定义:

trustServerCertificate=false

那么您可能需要设置以下内容(除非一切都匹配):

disableSslHostnameVerification=true
于 2020-10-27T16:26:27.723 回答