nodeBuilder()/ NodeBuilder - 无法解析符号 - Elastic Search Java API(在Android上)

时间:2017-06-20 18:19:46

标签: java android apache elasticsearch

我添加了Gradle依赖项compile 'org.elasticsearch.client:transport:5.2.1'

当Gradle构建同步时,我收到了警告列表。

Warning:WARNING: Dependency commons-logging:commons-logging:1.1.3 is ignored for release as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.5.2 is ignored for release as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency commons-logging:commons-logging:1.1.3 is ignored for release as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.5.2 is ignored for release as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency commons-logging:commons-logging:1.1.3 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.5.2 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency commons-logging:commons-logging:1.1.3 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.5.2 is ignored for debug as it may be conflicting with the internal version provided by Android.

但是Gradle构建成功了。现在我在nodeBuilder()NodeBuilder收到错误消息。错误是:Cannot resolve symbol。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

ElasticSearch托管在Maven中心。在Maven项目中,您可以定义要在pom.xml文件中使用的ElasticSearch版本,如下所示:

<dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>0.90.3</version>
</dependency>

Android Studio并不使用Maven作为其构建者;它使用Gradle代替。因此,请尝试添加此依赖项:

dependencies {
    ...
    compile 'org.elasticsearch:elasticsearch:0.90.3'
}