public class PeripheralManager - returning all stubs

227 views Asked by At

I have imported implementation 'com.google.android.things:androidthings:1.0'

And when I execute code, it throws a runtime error because inside of the PeripheralManager class the methods are all stubs:

    public List<String> getUartDeviceList() {
        throw new RuntimeException("Stub!");
    }

This was working several months ago, I've tried changing implementation to compile

2

There are 2 answers

2
shalafi On

Which device are you running it into? This API is only available on Android Things boards, not on phones.

2
Nick Felker On

There are several conditions you should verify in your project:

  • Your device must be either the i.MX7D or Raspberry Pi 3B with the Android Things OS on it, as noted in the hardware guide.
  • Your app/build.gradle must use compileOnly 'com.google.android.things:androidthings:1.0'
  • Your app/src/main/AndroidManifest.xml must include the following as a child of the application element:
<uses-library android:name="com.google.android.things"/>

You may also want to check properties like the targetSdkVersion being 27. If you continue to run into trouble, check out Android Things sample projects.