Kevin Krumwiede
Kevin Krumwiede

Reputation: 10308

Android SDK 21 ignoring imports in AIDL?

I'm maintaining a project that uses the ancient and unsupported pcgod Mumble client library. It contains this AIDL file:

package org.pcgod.mumbleclient.service;

import org.pcgod.mumbleclient.service.model.User;
import org.pcgod.mumbleclient.service.model.Message;
import org.pcgod.mumbleclient.service.model.Channel;

interface IServiceObserver {
    void onChannelAdded(in Channel channel);
    void onChannelRemoved(in Channel channel);
    void onChannelUpdated(in Channel channel);

    void onCurrentChannelChanged();

    void onCurrentUserUpdated();

    void onUserAdded(in User user);
    void onUserRemoved(in User user);
    void onUserUpdated(in User user);

    void onMessageReceived(in Message msg);
    void onMessageSent(in Message msg);

    /**
     * Called when the connection state changes.
     */
    void onConnectionStateChanged(int state);
}

The project built fine with SDK 19. But after upgrading to SDK 21, it ignores the Message import and generates onMessageReceived(android.os.Message) instead of onMessageReceived(org.pcgod.mumbleclient.service.model.Message). Naturally, this breaks all the code that uses it. I fixed the problem by using the fully-qualified class name in the method specification.

I don't really know anything about AIDL. Is this a bug in SDK 21, or has the AIDL file been wrong the whole time and SDK 21 just got stricter?

Upvotes: 3

Views: 273

Answers (2)

Jeffrey Mixon
Jeffrey Mixon

Reputation: 13656

Based on my experience, any custom classes imported in the AIDL interface should exist in the same package as the interface itself.

As to how it worked in the past, I'm not sure, but if you've updated the Build Tools package recently, then it could now enforce or be stricter on this requirement for some reason.

Upvotes: 1

danny117
danny117

Reputation: 5651

Check your build path and ensure the pcclod class is at the top.

project properties java build path order and export

When you directly qualify an object you are possibly overriding the build path.

Upvotes: 0

Related Questions