Samsung Resources$NotFoundException in Editor$SuggestionsPopupWindow.initContentView()

Refresh

November 2018

Views

37 time

2

Crash occurs on Samsung devices (J7 and S7) running Android 7.0.

I've built a tiny test app and can reproduce the crash. Single Activity that extends Activity (not AppCompatActivity), simple layout containing a single EditText with inputType="text". Target SDK is 8.

When positioning the cursor in the EditText and typing, words are suggested and words are underlined. Click on some of the underlined words or complete editing in the EditText and then return to the EditText. After entering some data and clicking around inside the EditText, the app will crash with this stacktrace:

06-01 18:56:37.990 10339-10339/sharpmind.de.samsungtest W/ResourceType: No package identifier when getting value for resource number 0x00000000
06-01 18:56:37.991 10339-10339/sharpmind.de.samsungtest D/AndroidRuntime: Shutting down VM
06-01 18:56:37.992 10339-10339/sharpmind.de.samsungtest E/AndroidRuntime: FATAL EXCEPTION: main
Process: sharpmind.de.samsungtest, PID: 10339
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:202)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2970)
at android.content.res.Resources.getLayout(Resources.java:1986)
at android.view.LayoutInflater.inflate(LayoutInflater.java:425)
at android.view.LayoutInflater.inflate(LayoutInflater.java:378)
at android.widget.Editor$SuggestionsPopupWindow.initContentView(Editor.java:3704)
at android.widget.Editor$PinnedPopupWindow.<init>(Editor.java:3395)
at android.widget.Editor$SuggestionsPopupWindow.<init>(Editor.java:3683)
at android.widget.Editor.replace(Editor.java:432)
at android.widget.Editor$3.run(Editor.java:2359)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)

With target SDK set to 14, the crash does not occur.

If I disable the autocorrect and word suggestions (which isn't that easy to do on a Samsung device), the crash also does not occur. But this makes my users really really angry, so it isn't a viable solution.


Activity:

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

    }
}

Layout:

<RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <EditText
            android:id="@+id/edittext"
            android:layout_width="match_parent"
            android:minHeight="200dp"
            android:inputType="text"
            android:layout_height="wrap_content"/>
</RelativeLayout>

0 answers