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

Assistance Needed: Error - "Failed to find provider info for com.goodwy.commons.contactsprovider" #58

Open
biencuong opened this issue Nov 4, 2024 · 2 comments

Comments

@biencuong
Copy link

I am encountering an issue in my application and need your assistance. The error message I am seeing is: Failed to find provider info for com.goodwy.commons.contactsprovider
I have ensured that I’ve correctly declared the ContentProvider in my AndroidManifest.xml file with the following configuration:

Despite this, the application is unable to find the provider. Could you please help me resolve this issue? I would appreciate any guidance on ensuring that the provider is correctly set up and accessible.

Thank you for your support.

Best regards,

@biencuong
Copy link
Author

biencuong commented Nov 4, 2024

Here's the guide in English to set up the ContactsProvider class and ensure it works correctly:

Here's the guide in English to set up the ContactsProvider class and ensure it works correctly:

  1. Create the Folder Structure
    Navigate to the root folder of your project, typically app/.
    Create directories to follow this structure: src/main/kotlin/com/goodwy/commons/.
    In Android Studio, you can right-click the src/main/kotlin folder, select "New > Directory," and sequentially create the folders com, then goodwy, and finally commons.
  2. Create the ContactsProvider Class
    Once the commons folder is ready, create a new file named ContactsProvider.kt inside it.
    Add the following code to ContactsProvider.kt:

package com.goodwy.commons
import android.content.ContentProvider
import android.content.ContentValues
import android.database.Cursor
import android.net.Uri
class ContactsProvider : ContentProvider() {
override fun onCreate(): Boolean {
return true
}
override fun query(
uri: Uri,
projection: Array?,
selection: String?,
selectionArgs: Array?,
sortOrder: String?
): Cursor? {
return null
}
override fun insert(uri: Uri, values: ContentValues?): Uri? {
return null
}
override fun delete(uri: Uri, selection: String?, selectionArgs: Array?): Int {
return 0
}
override fun update(
uri: Uri,
values: ContentValues?,
selection: String?,
selectionArgs: Array?
): Int {
return 0
}
override fun getType(uri: Uri): String? {
return null
}
}

  1. Declare ContactsProvider in AndroidManifest.xml
    After creating the ContactsProvider class, update your AndroidManifest.xml with the following entry inside the tag:
    <provider android:name="com.goodwy.commons.ContactsProvider" android:authorities="com.goodwy.commons.contactsprovider" android:exported="false" />

After completing these steps, try rebuilding and running the project. This should resolve issues with the ContactsProvider class, and the setup should now work correctly.

@Goodwy
Copy link
Owner

Goodwy commented Nov 5, 2024

What version of the app do you have installed and what operating system is on your device?
At what point do you receive an error message?
Have you had this error before or is it caused by some action?

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

No branches or pull requests

2 participants