I have a problem that I just cannot figure out. I am using Eclipse to create my own Content Provider but keep getting the following error:
[..] ERROR/ActivityThread(1051): Failed to find provider info for my.package.provider.countrycontentprovider
Code found here: http://codepad.org/Rx00HjHd
Main parts:
public class CountryContentProvider extends ContentProvider {
public static final String PROVIDER =
"my.package.provider.countrycontentprovider";
public static final Uri CONTENT_URI =
Uri.parse("content://" + PROVIDER + "/country");
// ...
@Override
public boolean onCreate() { return true; }
// ...
}
// from my activity
ContentResolver resolver = getContentResolver();
Cursor c = resolver.query(CountryContentProvider.CONTENT_URI,
null, null, null, null);
// AndroidManifest.xml
<provider
android:name="my.package.provider.CountryContentProvider"
android:authorities="my.package.provider.countrycontentprovider" />
I have added the provider to the manifest and return true from the onCreate
function. I use the CountryContentProvider.CONTENT_URI
in my activity to get the Content from my provider, but I just keep getting that error message. I have removed and added the code three times (in case of eclipse melt down) to no avail.
I must be missing something. Can someone point me in the right direction?
I was able to reproduce your problem when I moved <provider> out of the <application>...</application> tag. Eclipse didn't say anything like error or warning.
Fortunately this issue is detected by Android Lint starting from ADT 20.