I'm using a simple search dialog that works fine in the installable app, but I'm getting a NullPointerException only when running the code as an Instant App:
java.lang.NullPointerException: Attempt to invoke interface method 'android.app.SearchableInfo android.app.ISearchManager.getSearchableInfo(android.content.ComponentName)' on a null object reference
All code and resources are inside the base module.
This happens inside onCreateOptionsMenu in my launcher activity:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_entity, menu);
    // Associate searchable configuration with the SearchView
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    return true;
}
This is the menu.xml file (using appcompat):
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:id="@+id/search"
        android:icon="@drawable/ic_search_white"
        android:title="@string/menu_search"
        app:actionViewClass="android.support.v7.widget.SearchView"
        app:showAsAction="collapseActionView|ifRoom"/>
</menu>
The searchable.xml file is as follows, just in case:
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
            android:label="@string/app_name"
            android:hint="@string/search_hint" >
</searchable>
Activity in Manifest.xml:
<activity android:name=".EntityActivity">
    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.SEARCH"/>
    </intent-filter>
    <meta-data
        android:name="android.app.searchable"
        android:resource="@xml/searchable"/>
</activity>
The installable app works fine. Any ideas why this could be happening?