Compiling AIDL File : couldn't find import for class

11,267 views
Skip to first unread message

Kalpesh Patil

unread,
Dec 14, 2010, 8:31:16 AM12/14/10
to android-platform
Hi,

I am trying to "import android.view.Surface" and "import
android.view.SurfaceHolder" inside an AIDL file (IMyTrial.aidl)
intended
to be used as part of a JAVA library.
The Android.mk calls include$(BUILD_JAVA_LIBRARY)

However, when I build it, the "aidl" tool always return the error
"couldn't find import for class android.view.SurfaceHolder & for
android.view.Surface ".

But a JAVA file MyTrial.java at same directory location is able to
import both android.view.Surface & android.view.SurfaceHolder.

I found out that packages/apps/Music is using
IMediaPlaybackService.aidl in similar way.
Only difference between Android.mk is
My Android.mk uses include$(BUILD_JAVA_LIBRARY) &
Android.mk for Music.apk uses include $(BUILD_PACKAGE)

Any help/suggestions will be highly appreciated.

Thanking in advance
Regards
Kalpesh Patil

Ying Wang

unread,
Dec 14, 2010, 1:33:39 PM12/14/10
to android-...@googlegroups.com
You have to add such a line:
LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.


Kalpesh Patil

unread,
Dec 14, 2010, 3:11:57 PM12/14/10
to android-...@googlegroups.com
Thanks a lot Ying. It really worked with it.

But I still face some issue.

I want to import following two
"import android.view.Surface"
"import android.view.SurfaceHolder"

Out of these two, android.view.Surface is getting imported.
But android.view.SurfaceHolder is NOT getting imported.

My actual intention is to pass Surface to my custom library, for which, I need to pass SurfaceHolder and in custom library, I will extract Surface with SurfaceHolder.getSurface().

So importing SurfaceHolder is more important for me.

Any help for this will be highly appreciated.

Thanks and Regards
Kalpesh Patil

MarkusG

unread,
Dec 15, 2010, 4:41:01 AM12/15/10
to android-platform
Well SurfaceHolder is an interface and not a class derived from
android.os.Parcelable so I don't think you can use it in your AIDL
file.

On Dec 14, 9:11 pm, Kalpesh Patil <kalpeshpatil.ti....@gmail.com>
wrote:
> Thanks a lot Ying. It really worked with it.
>
> But I still face some issue.
>
> I want to import following two
> "import android.view.*Surface*"
> "import android.view.*SurfaceHolder*"
>
> Out of these two, android.view.*Surface *is getting imported.
> But android.view.*SurfaceHolder *is *NOT *getting imported.
>
> My actual intention is to pass Surface to my custom library, for which, I
> need to pass *SurfaceHolder *and in custom library, I will extract Surface
> with *SurfaceHolder.getSurface()*.
>
> So importing *SurfaceHolder *is more important for me.
>
> Any help for this will be highly appreciated.
>
> Thanks and Regards
> Kalpesh Patil
>
> >> android-platfo...@googlegroups.com<android-platform%2Bunsu...@googlegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/android-platform?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "android-platform" group.
> > To post to this group, send email to android-...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > android-platfo...@googlegroups.com<android-platform%2Bunsu...@googlegroups.com>
> > .

iblues

unread,
Dec 16, 2010, 1:21:02 AM12/16/10
to android-platform
Hi Kalpesh,

Why dont you get the instance of Surface from SurfaceHolder @ the java
layer itself and then pass it via IPC? Surface gets converted to
ISurface over IPC I beleive..

But I trust you cannot access any methods within ISurface as its a
protected class..

Kalpesh Patil

unread,
Dec 16, 2010, 2:17:10 AM12/16/10
to android-...@googlegroups.com
Thanks a lot Markus and iblues for your response.

iblues
As per my knowledge, Surface should be by across preferably through SurfaceHolder only. So I insist on using SurfaceHolder.

I have MyService (Custom Service) loaded in SystemServer which has MyService.java and corresponding IMyservice.aidl.
I want to pass surface from VideoView.java (or any outside file) to MyService, for which i intended to import SurfaceHolder in IMyService.aidl. I register to IMyService in VideoView.java.

Since import of SurfaceHolder didnt work, I tried to pass Surface directly by passing (mSurfaceHolder.getSurface()) from VideoView.java to a method setSurface(Surface tmpsurface) declared in IMyService.aidl and implemented in MyService.java
When I print Surface in VideoView.java before passing, I get proper value. But inside setSurface(Surface tmpsurface) in MyService.java, I receive/read MyService.java.

Please suggest what could be going wrong here.
It will be also helpful if you briefly explain what you mean by IPC method.

Thanks and Regards
Kalpesh Patil


To unsubscribe from this group, send email to android-platfo...@googlegroups.com.

Kanagal Raj Ramaswamy

unread,
Mar 14, 2016, 4:06:48 PM3/14/16
to android-platform
Hi All,

Based on the below conversations, I am getting confused on whether I can pass the surface or surface holder in the AIDL or not. Please can you suggest on whether I can pass the Surface or SurfaceHolder in the AIDL or not?

Also how to compile my app by having the AIDL with SurfaceView  or SurfaceHolder in ADT Eclipse?

Thanks,
Kanagal Raj

Андрей Суворов

unread,
Feb 13, 2017, 11:34:52 AM2/13/17
to android-platform
Yes you can. You can pass SurfaceView via simple AIDL, and make holder from it on recieved side.



понедельник, 14 марта 2016 г., 23:06:48 UTC+3 пользователь Kanagal Raj Ramaswamy написал:
Reply all
Reply to author
Forward
0 new messages