android - ServiceLoader.load is not finding the META-INF/services -


so want build extensible android application developers can add 'customdevice' classes , main program run them automatically without editing existing code.

i've read service provider interface , thought nice way go it.

so tested , created interface called 'icustomdevice' custom device classes expected implement.

i've created class called 'dummydevice' implements icustomdevice.

both dummydevice , icustomdevice in same package "customdevicepackage".

so in main program run following.

    serviceloader<icustomdevice> loader = serviceloader.load(icustomdevice.class);     iterator<icustomdevice> devices = loader.iterator();     system.out.println("does have devices? " + devices.hasnext()); 

it returns false, means it's not finding 'dummydevice'

in eclipse project created folder @ 'src' called meta-inf , under it, subfolder called 'services'.

'services' has file named 'customdevicepackage.icustomdevice' line of content 'customdevicepackage.dummydevice'.

am doing right? every example see spi loading jars. i'm not loading jar, i'm trying run class in same project. method works loading jars? want program support loading local subclasses , external jars alike.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -