gpt4 book ai didi

java - 找不到从方法 `javax.naming.ldap.LdapName` 引用的类 `com.mashape.relocation.conn.ssl.AbstractVerifier.extractCN`

转载 作者:行者123 更新时间:2023-11-29 09:29:06 27 4
gpt4 key购买 nike

我有以下示例 Activity :

package teste.myapplication;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;


public class MainActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

TextView text = (TextView) findViewById(R.id.mainText);
try {
text.setText(Unirest.get("http://google.com").asString().getBody());
}catch (UnirestException e){
throw new RuntimeException(e);
}
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}
}

我在 official guide 之后从源代码编译了 Unirest并以名为 unirest-java-1.4.6-SNAPSHOT-withDependency-ShadedForAndroid.jar.jar 结尾。

当我运行该 Activity 时,它立即中断并出现标题错误。这是完整的堆栈跟踪(带有错误过滤器的 logcat):

04-03 10:50:55.150    1767-1767/teste.myapplication E/dalvikvm﹕ Could not find class 'javax.naming.ldap.LdapName', referenced from method com.mashape.relocation.conn.ssl.AbstractVerifier.extractCNs
04-03 10:50:55.170 1767-1767/teste.myapplication E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: teste.myapplication, PID: 1767
java.lang.VerifyError: com/mashape/relocation/conn/ssl/AbstractVerifier
at com.mashape.relocation.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:126)
at com.mashape.relocation.impl.conn.PoolingHttpClientConnectionManager.getDefaultRegistry(PoolingHttpClientConnectionManager.java:98)
at com.mashape.relocation.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConnectionManager.java:105)
at com.mashape.unirest.http.options.Options.refresh(Options.java:73)
at com.mashape.unirest.http.options.Options.<clinit>(Options.java:46)
at com.mashape.unirest.http.HttpClientHelper.prepareRequest(HttpClientHelper.java:154)
at com.mashape.unirest.http.HttpClientHelper.request(HttpClientHelper.java:134)
at com.mashape.unirest.request.BaseRequest.asString(BaseRequest.java:56)
at teste.myapplication.MainActivity.onCreate(MainActivity.java:22)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)

build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "teste.myapplication"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.2'
compile files('libs/unirest-java-1.4.6-SNAPSHOT-withDependency-ShadedForAndroid.jar')
}

我不知道会是什么。我已经尝试重新编译该库,但没有任何变化。

最佳答案

在您的安卓设备上,转到“设置”、“关于软件”、“系统更新”、“更新”

关于java - 找不到从方法 `javax.naming.ldap.LdapName` 引用的类 `com.mashape.relocation.conn.ssl.AbstractVerifier.extractCN`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29434271/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com