5

I have the following project structure.

enter image description here

My StockInfo.java is perfectly fine.

StockInfo.java (No error)

package org.yccheok.jstock.engine;

import android.os.Parcel;
import android.os.Parcelable;

public class StockInfo implements Parcelable {
    ...
    ...

StockInfo.aidl (No error)

package org.yccheok.jstock.engine;

parcelable StockInfo;

StockInfoObserver.aidl (Error!)

package org.yccheok.jstock.engine;

interface StockInfoObserver {

    void update(StockInfo stockInfo);
}

AutoCompleteApi.aidl (Error!)

package org.yccheok.jstock.engine;

interface AutoCompleteApi {

    void handle(String string);
    void attachStockInfoObserver(StockInfoObserver stockInfoObserver);
}

However, Eclipse complains in StockInfoObserver.aidl (It does complain AutoCompleteApi.aidl too, as it cannot process StockInfoObserver.aidl),

parameter stockInfo (1) unknown type StockInfo

I tried for an hour, but still not able to find out, why in aidl, StockInfo is not being recognized although I had

  1. Provided StockInfo.aidl
  2. Provided StockInfo.java

Any idea?

Here are the complete errors.

enter image description here

Note, AutoCompleteApi.aidl is very much dependent on StockInfoObserver.aidl. That's why you will see the error.

I share the entire project for your reference purpose : https://www.dropbox.com/s/0k5pe75jolv5mtq/jstock-android.zip

TN888
  • 7,659
  • 9
  • 48
  • 84
Cheok Yan Cheng
  • 47,586
  • 132
  • 466
  • 875
  • probably due to another error prevent the code generation to happen. what are the other errors we see on your screenshot ? – njzk2 Jan 10 '13 at 16:51
  • you need first to implement handle(String) in autocompleservice – njzk2 Jan 10 '13 at 17:02

1 Answers1

7

According to Android documentation You must include an import statement for each additional type not listed above, even if they are defined in the same package as your interface

Try to add this line to StockInfoObserver.aidl

import org.yccheok.jstock.engine.StockInfo;
Vladimir Mironov
  • 30,514
  • 3
  • 65
  • 62
  • You suggestion works pretty well. After adding import, seems that I need to put in/out/inout for StockInfo parameter. My activity is going to implement StockInfoObserver.Stub, and it is going to receive StockInfo from AutoCompleteService. The activity will perform readonly operation on received StockInfo. May I know, should I use in, out, or inout for the above case? – Cheok Yan Cheng Jan 10 '13 at 17:13
  • 1
    You should use `in` in your case – Vladimir Mironov Jan 10 '13 at 17:19