IllegalArgumentException Unknown Uri content SearchableDict

If you change the package name, you have to add new package name in:

DictionaryProvider.java

 
public class DictionaryProvider extends ContentProvider {
    String TAG = "DictionaryProvider";
 
//    public static String AUTHORITY = "com.example.android.searchabledict.DictionaryProvider";
// change to your new package name
public static String AUTHORITY = "com.myweb.mysubdomen.searchabledict.DictionaryProvider";
    public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/dictionary");
 
 
// in AndroidManifest.xml
//change com.example.android to your package e.g. com.myweb.mysubdomen
<!-- Provides search suggestions for words and their definitions. -->
        <provider android:name="com.example.android.searchabledict.DictionaryProvider"
            android:configChanges="keyboard|keyboardHidden|orientation"
                  android:authorities="com.example.android.searchabledict.DictionaryProvider" />
 
        <!-- Points to searchable activity so the whole app can invoke search. -->
        <meta-data android:name="android.app.default_searchable"
            android:configChanges="keyboard|keyboardHidden|orientation"
                   android:value=".SearchableDictionary" />
 
// I change like this:
        <!-- Provides search suggestions for words and their definitions. -->
        <provider android:name=".DictionaryProvider"
            android:configChanges="keyboard|keyboardHidden|orientation"
                  android:authorities="cz.okhelp.android.searchabledict.DictionaryProvider" />
 
        <!-- Points to searchable activity so the whole app can invoke search. -->
        <meta-data android:name="android.app.default_searchable"
            android:configChanges="keyboard|keyboardHidden|orientation"
                   android:value=".SearchableDictionary" />

Do not forget change package name in all java class and xml/searchable.xml
In my project I changed like this:

<searchable xmlns:android="http://schemas.android.com/apk/res/android"
        android:label="@string/search_label"
        android:hint="@string/search_hint"
        android:searchSettingsDescription="@string/settings_description"
        android:searchSuggestAuthority="cz.okhelp.android.searchabledict.DictionaryProvider"
        android:searchSuggestIntentAction="android.intent.action.VIEW"
        android:searchSuggestIntentData="content://cz.okhelp.android.searchabledict.DictionaryProvider/dictionary"
        android:searchSuggestSelection=" ?"
        android:searchSuggestThreshold="1"
        android:includeInGlobalSearch="true"
        >
 </searchable>
This entry was posted in Bugs, warnings, errors and tagged , , . Bookmark the permalink.


Comments are closed.



1,231 views