Searchable.xml 在构建免安装应用程序时找不到

Searchable.xml not found on build of instant app

feature/src/main/res/xml/searchable.xml:

<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
    android:label="@string/app_name"
    android:hint="@string/search_hint" >
    <!-- TODO https://developer.android.com/guide/topics/search/searchable-config -->
</searchable>

在我的构建即时应用程序中找不到,除了样式之外,基本模块中没有任何内容。错误输出行是:

AGPBI: {"kind":"error","text":"error: resource xml/searchable (aka at.mts.arnatomy.app:xml/searchable) not found.","sources":[{"file":"./arnatomy/base/build/intermediates/manifests/full/feature/debug/AndroidManifest.xml","position":{"startLine":53}}],"original":"","tool":"AAPT"}

对应的动作在feature/src/main/AndroidManifest.xml:

<activity
        android:name=".SearchableActivity"
        android:launchMode="singleTop">
        <intent-filter>
            <action android:name="android.intent.action.SEARCH" />
        </intent-filter>
        <meta-data android:name="android.app.searchable"
            android:resource="@xml/searchable"/>
</activity>

中对应文本域的布局为feature/src/main/res/layout/search.xml:

...
<android.support.v7.widget.AppCompatEditText
            android:id="@+id/text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="@string/search_hint"
            android:imeOptions="actionSearch"
            android:inputType="text"
            android:layout_weight="1"/>
...

feature/src/main/java/SearchableActivity.java的相关代码为:

...
AppCompatEditText text = findViewById(R.id.text);
        text.setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                boolean handled = false;
                if (actionId == EditorInfo.IME_ACTION_SEND) {
                    doMySearch(v.getText().toString());
                    handled = true;
                }
                return handled;
            }
        });
...

方法 doMySerach 只打印一个 Toast。 minSdkVersion是24,target-compileSdkVersion都是27,怎么能searchable.xml找不到文件?我也尝试过,但是基本模块中的 xml 文件夹,仍然没有成功。

xml 文件夹移动到基本模块 并进行干净重建 解决了问题。在即时应用程序中,searchable.xml 接缝只能出现在构建模块中。