I got this error when I try to create a aidl.
here`s my UploadSInterface.aidl
package br.com.android.pixelhouse.services;
interface UploadSInterface {
void execute(out File file);
void cancelUpload();
}
now File parcelable class
---------------------------------------------------------------------------
package br.com.android.pixelhouse;
import java.io.InputStream;
import android.os.Parcel;
import android.os.Parcelable;
@SuppressWarnings("unchecked")
public class File implements Parcelable {
public static final int TYPE_IMAGE = 0;
public static final int TYPE_VIDEO = 1;
public static final int TYPE_MUSIC = 2;
public static final int TYPE_OTHERS = 3;
private InputStream input;
private String description;
private String name;
private int type;
public static final Parcelable.Creator<File>CREATOR = new
Parcelable.Creator() {
public File createFromParcel(Parcel in) {return new File(in);}
public Object[] newArray(int size) {
// TODO Auto-generated method stub
return null;
}
};
public File(InputStream input, String name, String description, int
type) {
setInput(input);
setName(name);
setDescription(description);
setType(type);
}
public File(Parcel in) {
// TODO Auto-generated constructor stub
}
public InputStream getInput() {
return input;
}
public void setInput(InputStream input) {
this.input = input;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int describeContents() {
return 0;
}
public void writeToParcel(Parcel dest, int flags) {
dest.writeValue(getInput());
dest.writeString(getName());
dest.writeString(getName());
dest.writeInt(getType());
}
}
Here`s the thing,
when I do my aidl class like it`s today I got
parameter file (1) unknow type
when I do this
import br.com.pixelhouse.mymoto.services.File;
interface UploadSInterface {
void execute(out File file);
void cancelUpload();
}
I got?
couldn't find import for class br.com.pixelhouse.mymoto.services.File
On 14 abr, 22:34, Xavier Ducrohet <[email protected]> wrote:
> I have just realized something.
>
> If you create/edit parcelable type aidl files, this does not trigger a
> recompilation of the interface aidl files that depends on it. In fact,
> aidl files are only recompiled when the aidl file is touched.
>
> We'll do a quick fix for the final ADT 0.9 (which will most likely be
> a full recompilation of all aidl files whenever 1 aidl file is
> changed), and implement true dependency support later to minimize
> unneeded recompilations.
>
> Xav
>
>
>
> On Tue, Apr 14, 2009 at 2:02 PM, Xavier Ducrohet <[email protected]> wrote:
> > I just did a quick test following the information in the link I posted
> > above and it is working for me.
>
> > Make sure your aidl file declares the package it's in (like any java class).
>
> > Xav
>
> > On Tue, Apr 14, 2009 at 1:05 PM, Xavier Ducrohet <[email protected]> wrote:
> >> oh I missed this message :(
>
> >> Let me do a quick test...
>
> >> On Tue, Apr 14, 2009 at 11:18 AM, Zach Hobbs <[email protected]>
> >> wrote:
>
> >>> Some more info:
>
> >>> - I tried creating an aidl file with the same name as the Parcelable
> >>> class, and I get an error in the console like: <path to class>/
> >>> <class>.aidl:1 interface <package>.<class> should be declared in a
> >>> file called com.aidl. I tried declaring the Parcelable in com.aidl and
> >>> that didn't work either.
>
> >>> - The documentation in 1.5 on AIDL still refers to the "Android Tools
> >>>> Create Aidl preprocess file for Parcelable classes" which is not
> >>> available in ADT 0.9. Should I open a bug for this?
>
> >>> Thanks,
> >>> Zach
>
> >>> On Apr 14, 12:52 pm, Zach Hobbs <[email protected]> wrote:
> >>>> I'm attempting to get build my project with the early preview SDK,
> >>>> targeting 1.1 and am having problems getting AIDL files to recognize
> >>>> imports for Parcelables. In the previous ADT you could right click on
> >>>> your project, hit "Android Tools" and have an option something like
> >>>> "Generate AIDL for Parcelables". This would create a file
> >>>> project.aidl in your project's root containing a line for each
> >>>> Parceable in your project.
>
> >>>> With the new SDK/ADT anytime I try to import a Parcelable in an AIDL
> >>>> file I get "Couldn't find import for class ... " even though I still
> >>>> have the project.aidl file in the project's root. Also, the option to
> >>>> generate the AIDL for the Parcelables is no longer available. Anyone
> >>>> know how to get your Parcelables noticed in the new SDK?
>
> >>>> Thanks,
> >>>> Zach
>
> >> --
> >> Xavier Ducrohet
> >> Android Engineer, Google.
>
> > --
> > Xavier Ducrohet
> > Android Engineer, Google.
>
> --
> Xavier Ducrohet
> Android Engineer, Google.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---