Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6055473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:16:07+00:00 2026-05-23T08:16:07+00:00

I have an application which interacts with a custom service via two aidl implementations.

  • 0

I have an application which interacts with a custom service via two aidl implementations. When the service is ran, I am running into the following exception:

ERROR/AndroidRuntime(9435): FATAL EXCEPTION: main
ERROR/AndroidRuntime(9435): java.lang.NullPointerException
ERROR/AndroidRuntime(9435): at android.os.Parcel.readException(Parcel.java:1328)
ERROR/AndroidRuntime(9435): at android.os.Parcel.readException(Parcel.java:1276)
ERROR/AndroidRuntime(9435): at myservice.IAsyncService$Stub$Proxy.addItems(IAsyncService.java:259)

From this error, I think it is something to do with the marshalling which is carried out. So I checked both aidl implementations; the first aidl (which uses primitives) seemed to work fine (I think because they dont need me to specify imports/implementations); the second (which uses a custom object) however seems to crash giving the above error. I have made sure the custom object correctly implements parcelable (see bottom of post for implementation), and have even tried referencing the custom object from a separate aidl file as shown below.

(Seperate aidl file.) – (IMyItem.aidl)

package myservice;
parcelable myservice.MyItem;

(Other aidl file.) – (IAsyncService.aidl)

package myservice;
import myservice.IMyItem;

interface IAsyncService
{
    void addItems(in List<MyItem> itemCollection);
}

(Parcelable Implementation) (MyItem)

public class MyItem implements Parcelable
{
    private String name = "";

    public MyItem(String name)
    {
        this.name = name.trim();
    }

    public MyItem(Parcel source) {
        readFromParcel(source);
    }

    public void setItem(String name)
    {
        this.name = name;
    }

    public String getName()
    {
        return this.name;
    }

    public static final Parcelable.Creator<MyItem> CREATOR = new Parcelable.Creator<MyItem>() {
        @Override
        public MyItem[] newArray(int size) {
            return new MyItem[size];
        }

        @Override
        public MyItem createFromParcel(Parcel source) {
            return new MyItem(source);
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel destination, int flags) {
        destination.writeString(this.name);
    }

    public void readFromParcel(Parcel source) {
        this.name = source.readString();
    }
}

Is there something I am missing or have completely overlooked?

Thanks
John

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:16:07+00:00Added an answer on May 23, 2026 at 8:16 am

    What you are seeing is that a NullPointerException has been thrown on the remote side, that exception was returned as a result, and re-thrown to your client. In these situations it helps a lot for debugging to find out what the original exception is. You can do this with a trick:

    In your class that implements the interface, override onTransact() to do this:

    protected boolean onTransact(int code, Parcel data, Parcel reply, int flags) {
        try {
            super.onTransact(code, data, reply, flags);
        } catch (RuntimeException e) {
            Log.w("MyClass", "Unexpected remote exception", e);
            throw e;
        }
    }
    

    Now when the crash happens you will also see in the log the original exception printed, with the line where it happened.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Silverlight application which interacts with a WCF service. It periodically receives
I have a C# service application which interacts with a database. It was recently
Ok, I have developed this WinForms client, which interacts with a server (ASPX Application)
I have an application which interacts over https with a server I have. I
I have web services written using java which interacts with the android application only
We have an application written in C language which interacts with Oracle database. This
I have a windows form application which interacts with a remote database. the database
I have a DOS batch script that invokes a java application which interacts with
I have an application in which users interact with each-other. I want to visualize
I have application which needs to use a dll (also written by me) which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.