You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Android手机APP中使用GPIO引脚?Android Things方案失效求替代

在Android手机APP中通过USB控制GPIO引脚的问题

问题描述

我尝试在Android智能手机APP中列举并控制通过USB线缆连接的GPIO引脚,使用PeripheralManager实现时遇到了问题。

实现代码

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val manager = PeripheralManager.getInstance()
    }

运行报错信息

Caused by: java.lang.RuntimeException: Stub!
at com.google.android.things.pio.PeripheralManager.getInstance(PeripheralManager.java:21)

已尝试的操作及新问题

  • 添加Android Things依赖:
dependencies {
implementation 'com.google.android.things:androidthings:1.0'
}
  • 在AndroidManifest.xml中添加库声明:
<application>
   <uses-library android:name="com.google.android.things"/>
</application>

执行上述操作后出现安装错误:

Installation failed due to: 'INSTALL_FAILED_MISSING_SHARED_LIBRARY: Reconciliation failed...: Reconcile failed: Package requires unavailable shared library com.google.android.things; failing!'

疑问

已知Android Things不支持手机设备,请问是否有其他方法可以在手机APP中使用GPIO引脚?

内容的提问来源于stack exchange,提问作者Jonah Firehill

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.17 22:14:58