# Using OscP5 in native Android environment

**URL:** <https://discourse.processing.org/t/using-oscp5-in-native-android-environment/29118>\
**Category:** Libraries\
**Created:** [April 4, 2021, 6:23pm UTC](https://discourse.processing.org/t/using-oscp5-in-native-android-environment/29118 "2021-04-04T18:23:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![5tefan](https://avatars.discourse-cdn.com/v4/letter/5/ecae2f/32.png) [@5tefan](https://discourse.processing.org/u/5tefan)\
**Post date:** [April 4, 2021, 6:23pm UTC](https://discourse.processing.org/t/using-oscp5-in-native-android-environment/29118/1 "2021-04-04T18:23:15Z")

</div>

Hello,

I’m not sure this is the right forum for my question but as it concerns OscP5 I thought I give it a try.  
I’m working on an Android application, using OscP5 in a native Android environment (i.e. not Android mode for processing). In general that works quite nicely. But now I’ve stumbled upon a problem I don’t understand:  
My app sends and receives OSC messages to and from more than one clients. That basically works. But when receiving messages I’d like to be able to distinguish between clients by their IP address resp. port (i.e. their `NetAddress`es). Following the `oscP5broadcastClient` example that seemed like an easy task:

```auto
void oscEvent(OscMessage theOscMessage) {
  println("sending address: " + theOscMessage.netAddress());
}

```

… which indeed prints out the sender’s address in the form `<ip address>:<port>`

In native Android, however, though I can capture the `OscMessage` with

```auto
mListener = new OscP5(context, 32000);
mEventListener = new OscEventListener() {
    @Override
    public void oscEvent(OscMessage oscMessage) {
        Log.d(TAG, "osc message: " + oscMessage);
    }
};
mListener.addListener(mEventListener);

```

… `oscMessage.netAddress()` crashes my app with an error:

```auto
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.net.InetAddress.getHostAddress()' on a null object reference

```

Does anyone have an idea why calling `netAddress` doesn’t work in native Android?

Thanks very much for your attention,  
Stefan
