无法找到'ContentProvider的“供应商信息 [英] Failed to find provider info for 'ContentProvider'

查看:115
本文介绍了无法找到'ContentProvider的“供应商信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,我只是想不通的一个问题。我使用Eclipse来创建自己的内容提供商,但不断收到以下错误:

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):未能找到供应商信息   my.package.provider.countrycontentprovider

[..] ERROR/ActivityThread(1051): Failed to find provider info for my.package.provider.countrycontentprovider

code在这里找到: HTTP://$c$cpad.org/Rx00HjHd

Code found here: http://codepad.org/Rx00HjHd

主要部分组成:

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" />

我已经加入了供应商清单,并从的onCreate 函数返回true。我用的是 CountryContentProvider.CONTENT_URI 在我的活动,从我的供应商的内容,但我只是不断收到该错误消息。我已删除,并增加了code三次(在日食的熔化)无济于事。
我必须失去了一些东西。有人能指出我朝着正确的方向?

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?

推荐答案

我能够重现你的问题,当我提出&LT;供应商>出的&lt的;应用> ...&LT; / Application>标签。 Eclipse中并没有说像错误或警告任何东西。

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.

幸运的是这个问题是由棉绒的Andr​​oid ADT的20日开始检测。

Fortunately this issue is detected by Android Lint starting from ADT 20.

这篇关于无法找到'ContentProvider的“供应商信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆