请求密钥时出现IOException:无效的设备密钥响应

问题描述:

我正在使用带有Google IOT的Pi 3来操作一些继电器,这些继电器控制灌溉系统上的阀门.该系统使用互联网获取天气预报以计算要消耗的水量,并使用NanoHTTPD提供UI.

I'm using a Pi 3 with google IOT to operate some relays that control valves on an irrigation system. The system uses the internet to get a weather forecast to work how much water to use, and uses NanoHTTPD to provide a UI.

它运行得很好,但偶尔我会遇到一个错误,该错误使整个过程停止.从日志文件中:

It's running nicely, but occasionally I get an error which stops the whole thing. From the log files:

05-04 05:26:14.677 737-1077/com.google.android.gms.persistent W/Conscrypt: Could not set socket write timeout:
05-04 05:26:14.678 737-1077/com.google.android.gms.persistent W/Conscrypt:    java.lang.reflect.Method.invoke(Native Method)
       com.google.android.gms.org.conscrypt.Platform.setSocketWriteTimeout(:com.google.android.gms@11973330:13)
05-04 05:26:14.798 737-1077/com.google.android.gms.persistent W/Conscrypt: Could not set socket write timeout:
05-04 05:26:14.799 737-1077/com.google.android.gms.persistent W/Conscrypt:    java.lang.reflect.Method.invoke(Native Method)
       com.google.android.gms.org.conscrypt.Platform.setSocketWriteTimeout(:com.google.android.gms@11973330:13)
05-04 05:26:14.914 737-1077/com.google.android.gms.persistent W/GLSUser: [AppCertManager] IOException while requesting key: 
    java.io.IOException: Invalid device key response.
        at fmk.a(:com.google.android.gms@11973330:12)
        at fmk.a(:com.google.android.gms@11973330:64)
        at fmi.a(:com.google.android.gms@11973330:8)
        at fme.a(:com.google.android.gms@11973330:1)
        at fmd.a(:com.google.android.gms@11973330:10)
        at com.google.android.gms.auth.account.be.legacy.AuthCronChimeraService.b(:com.google.android.gms@11973330:7)
        at ers.call(:com.google.android.gms@11973330:3)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at kfr.run(:com.google.android.gms@11973330:26)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at kku.run(Unknown Source:7)
        at java.lang.Thread.run(Thread.java:764)

对于如何阻止这种情况的发生,我深表感谢.

I'd appreciate some hint on how to stop this from happening.

谢谢.

简单.这意味着与IOT服务关联的Google控制台上的密钥与Mac/Pi 3上本地存储的密钥不匹配.

Simple. This means that the key on the Google Console that is associated with the IOT service is not matching the one stored locally on your Mac/Pi 3.

只需运行: keytool -list -v -keystore <your keystore> -storepass <your store password> 并将SHA1SHA256下的密钥复制到Google控制台.

Just run: keytool -list -v -keystore <your keystore> -storepass <your store password> and copy the key under SHA1 or SHA256 to the Google Console.

如果keytool -genkeypair不存在,则可以创建keystore.

You can create a keystore if none is present by keytool -genkeypair.

对于其他有用的命令,请运行keytool -h.

For other useful commands run keytool -h.