0

Google Dataflow クライアントに依存している場合、Stackdriver Monitoring クライアントを使用して Java アプリケーションから単純な指標を構築できません。

私は例外を受け取ります:

Exception in thread "main" java.lang.NoSuchMethodError: io.grpc.okhttp.OkHttpChannelProvider.isAndroid()Z
    at io.grpc.okhttp.OkHttpChannelProvider.priority(OkHttpChannelProvider.java:51)
    at io.grpc.ManagedChannelProvider$1.getPriority(ManagedChannelProvider.java:49)
    at io.grpc.ManagedChannelProvider$1.getPriority(ManagedChannelProvider.java:41)
    at io.grpc.ServiceProviders$1.compare(ServiceProviders.java:78)
    at java.util.Collections$ReverseComparator2.compare(Collections.java:5178)
    at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
    at java.util.TimSort.sort(TimSort.java:220)
    at java.util.Arrays.sort(Arrays.java:1512)
    at java.util.ArrayList.sort(ArrayList.java:1462)
    at java.util.Collections.sort(Collections.java:175)
    at io.grpc.ServiceProviders.loadAll(ServiceProviders.java:75)
    at io.grpc.ServiceProviders.load(ServiceProviders.java:42)
    at io.grpc.ManagedChannelProvider.<clinit>(ManagedChannelProvider.java:37)
    at io.grpc.ManagedChannelBuilder.forAddress(ManagedChannelBuilder.java:36)
    at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:185)
    at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:157)
    at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:149)
    at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:151)
    at com.google.cloud.monitoring.v3.stub.GrpcMetricServiceStub.create(GrpcMetricServiceStub.java:173)
    at com.google.cloud.monitoring.v3.stub.MetricServiceStubSettings.createStub(MetricServiceStubSettings.java:184)
    at com.google.cloud.monitoring.v3.MetricServiceClient.<init>(MetricServiceClient.java:158)
    at com.google.cloud.monitoring.v3.MetricServiceClient.create(MetricServiceClient.java:139)
    at com.google.cloud.monitoring.v3.MetricServiceClient.create(MetricServiceClient.java:130)
    at SimpleMetric.main(SimpleMetric.java:7)

作成方法で:

import com.google.cloud.monitoring.v3.MetricServiceClient;

import java.io.IOException;

public class SimpleMetric {
    public static void main(String... args) throws IOException {
        MetricServiceClient metricServiceClient = MetricServiceClient.create();
    }
}

追加した場合のみ:

compile 'com.google.cloud.dataflow:google-cloud-dataflow-java-sdk-all:2.5.0'

依存関係としての私のgradleファイルのように。

plugins {
    id 'java'
}

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

    dependencies {
        compile 'com.google.cloud:google-cloud-monitoring:1.48.0'
        // exception with the dependency below
        compile 'com.google.cloud.dataflow:google-cloud-dataflow-java-sdk-all:2.5.0'

    }

この問題を Googleに報告しました。その間、回避策はありますか?

4

1 に答える 1