Home AIDL not finding inner classes
Reply: 1

AIDL not finding inner classes

Jason
1#
Jason Published in 2018-01-12 22:48:00Z

Trying to compile AIDL files found in the Android repo along with my Android project to use some of the built-in interfaces.

However, whenever I get to an inner type, I get the following error:

ITuner.aidl

aidl E 01-12 17:32:41 59280 1006000 type_namespace.cpp:129] In file ./app/src/main/aidl/android/hardware/radio/ITuner.aidl line 32 parameter config (argument 1):
aidl E 01-12 17:32:41 59280 1006000 type_namespace.cpp:129]     unknown type
aidl E 01-12 17:32:41 59280 1006000 type_namespace.cpp:107] In file ./app/src/main/aidl/android/hardware/radio/ITuner.aidl line 34 return type RadioManager.BandConfig:
aidl E 01-12 17:32:41 59280 1006000 type_namespace.cpp:107]     unknown type
aidl E 01-12 17:32:41 59280 1006000 type_namespace.cpp:107] In file ./app/src/main/aidl/android/hardware/radio/ITuner.aidl line 66 return type RadioManager.ProgramInfo:
aidl E 01-12 17:32:41 59280 1006000 type_namespace.cpp:107]     unknown type
aidl E 01-12 17:32:41 59280 1006000 type_namespace.cpp:107] In file ./app/src/main/aidl/android/hardware/radio/ITuner.aidl line 83 return type List<RadioManager.ProgramInfo>:
aidl E 01-12 17:32:41 59280 1006000 type_namespace.cpp:107]     unknown type

This happens for all inner types. What am I doing wrong?

Other things:

  • I copied all of the AIDL files in my project in the correct directory structures
  • All of the AIDL files build except the ones with inner classes. Inner classes give unknown type errors.
  • I am using the AIDL executable in the API 27 platform directory.
Larry Schiefer
2#
Larry Schiefer Reply to 2018-01-19 14:57:49Z

These AIDL files and their backing services/classes are hidden from the public API, meaning they are not stable/consistent for all versions of Android. You will not be able to directly use them in your code to access built-in services of the system. You'd have to rely on reflection to gain access to other hidden classes in order to then get access to the underlying binder object of the system provided service. Not a portable or easy solution. If you are trying to re-create the system services within your app and your app will only use your version, then it will make sense to pull these files into your app.

All of that being said, if you are trying to create these services are part of your app, there's more than just the AIDL needed. The AIDL defines the interface a service implements, which in turn generates some Java boilerplate code for you. The missing dependencies you are seeing are because those are not other service interfaces, but classes which are Parcelable, allowing them to be passed as arguments or returned from binder IPC methods. As an example, the missing dependency for RadioManager.BandConfig is an inner class defined in RadioManager.java. You would need this class in your project as well.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.553365 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO