Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get provider com.nt4f04und.android_content_provider_example.MyAndroidContentProvider #3

Closed
GlebUstimenkoWMG opened this issue Apr 8, 2022 · 2 comments · Fixed by #4

Comments

@GlebUstimenkoWMG
Copy link

Hello,

I'm trying to add functionality of providing data to example. I'm following instructions in README and I did all steps.

When I'm trying to build it - it stacks and shows me an error.

Launching lib/main.dart on sdk gphone x86 in debug mode... ✓ Built build/app/outputs/flutter-apk/app-debug.apk. E/AndroidRuntime(10875): FATAL EXCEPTION: main E/AndroidRuntime(10875): Process: com.nt4f04und.android_content_provider_example, PID: 10875 E/AndroidRuntime(10875): java.lang.RuntimeException: Unable to get provider com.nt4f04und.android_content_provider_example.MyAndroidContentProvider: java.lang.ClassNotFoundException: Didn't find class "com.nt4f04und.android_content_provider_example.MyAndroidContentProvider" on path: DexPathList[[zip file "/data/app/~~qFgYI7_uF_VuZ7SP_YEthQ==/com.nt4f04und.android_content_provider_example-r0Iu4fuBXqpjGethMdzamA==/base.apk"],nativeLibraryDirectories=[/data/app/~~qFgYI7_uF_VuZ7SP_YEthQ==/com.nt4f04und.android_content_provider_example-r0Iu4fuBXqpjGethMdzamA==/lib/x86, /data/app/~~qFgYI7_uF_VuZ7SP_YEthQ==/com.nt4f04und.android_content_provider_example-r0Iu4fuBXqpjGethMdzamA==/base.apk!/lib/x86, /system/lib, /system_ext/lib]] E/AndroidRuntime(10875): at android.app.ActivityThread.installProvider(ActivityThread.java:7244) E/AndroidRuntime(10875): at android.app.ActivityThread.installContentProviders(ActivityThread.java:6780) E/AndroidRuntime(10875): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6697) E/AndroidRuntime(10875): at android.app.ActivityThread.access$1300(ActivityThread.java:237) E/AndroidRuntime(10875): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913) E/AndroidRuntime(10875): at android.os.Handler.dispatchMessage(Handler.java:106) E/AndroidRuntime(10875): at android.os.Looper.loop(Looper.java:223) E/AndroidRuntime(10875): at android.app.ActivityThread.main(ActivityThread.java:7656) E/AndroidRuntime(10875): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(10875): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) E/AndroidRuntime(10875): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) E/AndroidRuntime(10875): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.nt4f04und.android_content_provider_example.MyAndroidContentProvider" on path: DexPathList[[zip file "/data/app/~~qFgYI7_uF_VuZ7SP_YEthQ==/com.nt4f04und.android_content_provider_example-r0Iu4fuBXqpjGethMdzamA==/base.apk"],nativeLibraryDirectories=[/data/app/~~qFgYI7_uF_VuZ7SP_YEthQ==/com.nt4f04und.android_content_provider_example-r0Iu4fuBXqpjGethMdzamA==/lib/x86, /data/app/~~qFgYI7_uF_VuZ7SP_YEthQ==/com.nt4f04und.android_content_provider_example-r0Iu4fuBXqpjGethMdzamA==/base.apk!/lib/x86, /system/lib, /system_ext/lib]] E/AndroidRuntime(10875): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207) E/AndroidRuntime(10875): at java.lang.ClassLoader.loadClass(ClassLoader.java:379) E/AndroidRuntime(10875): at java.lang.ClassLoader.loadClass(ClassLoader.java:312) E/AndroidRuntime(10875): at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:147) E/AndroidRuntime(10875): at androidx.core.app.CoreComponentFactory.instantiateProvider(CoreComponentFactory.java:67) E/AndroidRuntime(10875): at android.app.ActivityThread.installProvider(ActivityThread.java:7228) E/AndroidRuntime(10875): ... 10 more Exited

Looks like it failed to found instance of class MyAndroidContentProvider.

@nt4f04uNd
Copy link
Owner

Hi @GlebUstimenkoWMG, I bet what was misleading/not clear from those instructions is that you also need to add a package directive at the top of the file where you defined MyAndroidContentProvider

package com.nt4f04und.android_content_provider_example

I added an example of AndroidContentProvider into example and made the README instructrions more clear in #4 - can you take a look if that's more helpful now?

@GlebUstimenkoWMG
Copy link
Author

Hi @nt4f04uNd, yes it works! Thank you for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants