android / input-samples

Multiple samples showing the best practices in input on Android.
Apache License 2.0
290 stars 268 forks source link

NullPointException #16

Open yuanyang1991 opened 7 years ago

yuanyang1991 commented 7 years ago

I use emulator which api is 25 to run this sample,when select "insert GIF",the sample crashed. the error StackTrace: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference at android.support.v4.content.FileProvider.parsePathStrategy(FileProvider.java:583) at android.support.v4.content.FileProvider.getPathStrategy(FileProvider.java:557) at android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:399) at com.example.android.commitcontent.ime.ImageKeyboard.doCommitContent(ImageKeyboard.java:97) at com.example.android.commitcontent.ime.ImageKeyboard.access$100(ImageKeyboard.java:49) at com.example.android.commitcontent.ime.ImageKeyboard$1.onClick(ImageKeyboard.java:206) at android.view.View.performClick(View.java:5637) at android.view.View$PerformClick.run(View.java:22429) 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:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

yuanyang1991 commented 7 years ago

I had fix this issue in my local project。 in ImageKeyboard.java,modify the AUTHORITY from "com.example.android.supportv13.sampleime.inputcontent" to "com.example.android.commitcontent.ime.inputcontent" which is same as AndroidManifest.xml。

ghost commented 7 years ago

Because the device I am testing has API lower than 25, I had to update the AndroidManifest.xml to match the AUTHORITY in ImageKeybard.java: <provider android:authorities="com.example.android.supportv13.sampleime.inputcontent"

codesid commented 7 years ago

@oyalhi Does it work on Android 6 API 23 for you? for me if send an image it does not get the MIME types at all as in it does not get inside this loop: because EditorInfoCompat.getContentMimeTypes(editorInfo) is empty

for (String mimeType : EditorInfoCompat.getContentMimeTypes(editorInfo)) { if (description.hasMimeType(mimeType)) { supported = true; break; } }

Supriyagai commented 7 years ago

I am having same issue as not getting mimeTypes...Can anyone help me in this

ghost commented 7 years ago

@codesid I am currently working on iOS full time for another project and not able to test or work on Android. Sorry for the late reply.

@Supriyagai please check my answer above, maybe it will help you.

TegenArade commented 7 years ago

Having the same issue is of not getting MimeTypes