android - Registering a content provider -
i have been trying create re-create of android's contactsprovider. wanted create minimal changes provider of work in app utilize data. however, want ensure real contacts not accessible app making planned create re-create of provider. after navigating though process of creating re-create provider different authority, tried phone call copied provider. @ point got 2 errors.
the first 1 in own app got error "failed find provider info 'contentprovider'" read this reply had taken care of mentioned here already.
the sec error happens in provider: java.lang.noclassdeffounderror: com.google.common.collect.immutableset$builder reason why getting first error. because provider never able access classes internal android, not getting registered valid provider , app not able "find" provider.
here manifest file contactmanager:-
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.prajitdas.contactmanager" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="18" android:targetsdkversion="19" /> <uses-permission android:name="android.permission.read_contacts" /> <uses-permission android:name="android.permission.get_accounts" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.prajitdas.contactmanager.contactmanager" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name="contactadder" android:label="@string/addcontacttitle"> </activity> </application> </manifest>
and manifest file contactsprovider:-
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.prajitdas.android.providers.contacts" android:versioncode="2" android:versionname="2.0"> <permission android:name="com.android.voicemail.permission.read_write_all_voicemail" android:label="@string/read_write_all_voicemail_label" android:description="@string/read_write_all_voicemail_description" android:permissiongroup="android.permission-group.personal_info" android:protectionlevel="system|signature" /> <uses-permission android:name="android.permission.read_contacts" /> <uses-permission android:name="android.permission.write_contacts" /> <uses-permission android:name="android.permission.get_accounts" /> <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.bind_directory_search" /> <uses-permission android:name="android.permission.update_app_ops_stats" /> <uses-permission android:name="android.permission.read_sync_settings" /> <uses-permission android:name="com.android.voicemail.permission.add_voicemail" /> <uses-permission android:name="com.android.voicemail.permission.read_write_all_voicemail" /> <application android:process="android.process.acore" android:label="@string/app_label" android:icon="@drawable/app_icon" android:allowbackup="true"> <!-- modified provider authorization --> <provider android:name="contactsprovider2" android:authorities="fakecontacts;com.prajitdas.android.providers.contacts" android:label="@string/provider_label" android:multiprocess="false" android:exported="true" android:readpermission="android.permission.read_contacts" android:writepermission="android.permission.write_contacts"> <path-permission android:pathprefix="/search_suggest_query" android:readpermission="android.permission.global_search" /> <path-permission android:pathprefix="/search_suggest_shortcut" android:readpermission="android.permission.global_search" /> <path-permission android:pathpattern="/contacts/.*/photo" android:readpermission="android.permission.global_search" /> <grant-uri-permission android:pathpattern=".*" /> </provider> <provider android:name="calllogprovider" android:authorities="fakecall_log" android:syncable="false" android:multiprocess="false" android:exported="true" android:readpermission="android.permission.read_call_log" android:writepermission="android.permission.write_call_log"> </provider> <provider android:name="voicemailcontentprovider" android:authorities="com.prajitdas.android.voicemail" android:syncable="false" android:multiprocess="false" android:exported="true" android:permission="com.android.voicemail.permission.add_voicemail"> </provider> <!-- handles database upgrades after otas, disables --> <receiver android:name="contactsupgradereceiver"> <!-- broadcast sent after core scheme has finished booting, before home app launched or boot_completed sent. --> <intent-filter> <action android:name="android.intent.action.pre_boot_completed"/> </intent-filter> </receiver> <receiver android:name="packageintentreceiver"> <intent-filter> <action android:name="android.intent.action.package_added" /> <data android:scheme="package" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.package_replaced" /> <data android:scheme="package" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.package_removed" /> <data android:scheme="package" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.package_changed" /> <data android:scheme="package" /> </intent-filter> </receiver> <receiver android:name="localechangereceiver"> <intent-filter> <action android:name="android.intent.action.locale_changed"/> </intent-filter> </receiver> <service android:name="voicemailcleanupservice"/> <activity android:name=".debug.contactsdumpactivity" android:label="@string/debug_dump_title" android:theme="@android:style/theme.holo.dialog" > <intent-filter> <action android:name="com.prajitdas.android.providers.contacts.dump_database"/> <category android:name="android.intent.category.default"/> </intent-filter> </activity> <provider android:name=".debug.dumpfileprovider" android:authorities="com.prajitdas.android.providers.contacts.dumpfile" android:exported="true"> </provider> </application> </manifest>
as can see, have copied original manifest files , modified new authorities provider. have done same java code, big post here. if can help me identify steps either create android internal calls work or maybe resolve first problem of "registering" provider on phone somehow, much appreciated.
com.google.common.collect.immutableset$builder isn't internal android class. part of google's guava library. need add together guava's jar dependency project compile (and, probably, others dependencies, check list contactsprovider in android.mk).
the actual way of adding jar dependency varies depending on utilize building app (e.g. ant, maven, gradle, or eclipse).
android