没有静态方法setSoKeepalive()错误

时间:2016-11-14 12:08:52

标签: android amazon-web-services android-gradle text-to-speech aws-sdk

我正在尝试在我的Android应用程序中实现Ivona TTS引擎。

但是我继续犯这个错误。 Ivona / AWS sdk和android之间似乎存在兼容问题。

有什么想法吗?这是我的代码和gradle

错误:

 java.lang.NoSuchMethodError: No static method setSoKeepalive(Lorg/apache/http/params/HttpParams;Z)V in class Lorg/apache/http/params/HttpConnectionParams; or its super classes (declaration of 'org.apache.http.params.HttpConnectionParams' appears in /system/framework/framework.jar:classes2.dex)
                                                                                 at com.amazonaws.http.HttpClientFactory.createHttpClient(HttpClientFactory.java:95)
                                                                                 at com.amazonaws.http.AmazonHttpClient.<init>(AmazonHttpClient.java:198)
                                                                                 at com.amazonaws.AmazonWebServiceClient.<init>(AmazonWebServiceClient.java:129)
                                                                                 at com.amazonaws.AmazonWebServiceClient.<init>(AmazonWebServiceClient.java:113)
                                                                                 at com.ivona.services.tts.IvonaSpeechCloudClient.<init>(IvonaSpeechCloudClient.java:152)
                                                                                 at com.ivona.services.tts.IvonaSpeechCloudClient.<init>(IvonaSpeechCloudClient.java:141)
                                                                                 at ivonatestsecond.com.ivonasecond.MainActivity.init(MainActivity.java:64)
                                                                                 at ivonatestsecond.com.ivonasecond.MainActivity.onCreate(MainActivity.java:24)
                                                                                 at android.app.Activity.performCreate(Activity.java:6237)
                                                                                 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                                 at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                                 at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                 at android.os.Looper.loop(Looper.java:148)
                                                                                 at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)

初​​始化:

 private static void init() {
    speechCloud = new IvonaSpeechCloudClient(new IvonaCredentials("xxxx", "xxxx"));
    speechCloud.setEndpoint("https://tts.eu-west-1.ivonacloud.com");
}

IvonaCredentials类

public class IvonaCredentials implements AWSCredentialsProvider {

public IvonaCredentials(String mSecretKey, String mAccessKey) {
    super();
    this.mSecretKey = mSecretKey;
    this.mAccessKey = mAccessKey;
}

private String mSecretKey;
private String mAccessKey;

@Override
public AWSCredentials getCredentials() {
    AWSCredentials awsCredentials = new AWSCredentials() {

        @Override
        public String getAWSSecretKey() {
            // TODO Auto-generated method stub
            return mSecretKey;
        }

        @Override
        public String getAWSAccessKeyId() {
            // TODO Auto-generated method stub
            return mAccessKey;
        };
    };
    return awsCredentials;
}

@Override
public void refresh() {
    // TODO Auto-generated method stub

}}

摇篮

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})

compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.ivona:ivona-speechcloud-sdk-java:1.0.0'
testCompile 'junit:junit:4.12'

0 个答案:

没有答案