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

Deosnt recognize ContactsPickerActivity.class #10

Open
nicknagi opened this issue Sep 18, 2015 · 8 comments
Open

Deosnt recognize ContactsPickerActivity.class #10

nicknagi opened this issue Sep 18, 2015 · 8 comments
Assignees

Comments

@nicknagi
Copy link

gives an error saying class not found. Imported your library using gradle. A bit new to all this..

@yasintabriz
Copy link

@nicknagi I had the same problem. I think there's an issue with the upload function because Gradle reports that .aar.asc is not a valid format. I downloaded the library and built it myself(and I had to remove the upload function from build.gradle). I might fork the repository and maintain it if I find time.

@codinguser
Copy link
Owner

I think if you include the library as: compile 'com.codinguser.android:contactpicker:3.0.0@aar'
it should work. I still have to find out why the annotation is necessary and update the README

@yasintabriz
Copy link

@codinguser Thank you, I'll use your repo in the next version if the issue is fixed rather than compile it myself.

@behelit
Copy link

behelit commented Feb 8, 2016

Using the @aar annotation allows it to build but I still receive an error when trying to start the activity:

android.content.ActivityNotFoundException: Unable to find explicit activity class {test.contactpicker/com.codinguser.android.contactpicker.ContactsPickerActivity}; have you declared this activity in your AndroidManifest.xml?
                                                                      at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1794)
                                                                      at android.app.Instrumentation.execStartActivity(Instrumentation.java:1512)
                                                                      at android.app.Activity.startActivityForResult(Activity.java:3917)
                                                                      at android.app.Activity.startActivityForResult(Activity.java:3877)
                                                                      at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:784)
                                                                      at test.contactpicker.MainActivity.onOptionsItemSelected(MainActivity.java:60)
                                                                      at android.app.Activity.onMenuItemSelected(Activity.java:2908)
                                                                      at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:361)
                                                                      at android.support.v7.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:147)
                                                                      at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:100)
                                                                      at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:100)
                                                                      at android.support.v7.app.ToolbarActionBar$2.onMenuItemClick(ToolbarActionBar.java:68)
                                                                      at android.support.v7.widget.Toolbar$1.onMenuItemClick(Toolbar.java:172)
                                                                      at android.support.v7.widget.ActionMenuView$MenuBuilderCallback.onMenuItemSelected(ActionMenuView.java:760)
                                                                      at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:811)
                                                                      at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)
                                                                      at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:958)
                                                                      at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:948)
                                                                      at android.support.v7.view.menu.MenuPopupHelper.onItemClick(MenuPopupHelper.java:191)
                                                                      at android.widget.AdapterView.performItemClick(AdapterView.java:310)
                                                                      at android.widget.AbsListView.performItemClick(AbsListView.java:1145)
                                                                      at android.widget.AbsListView$PerformClick.run(AbsListView.java:3042)
                                                                      at android.widget.AbsListView$3.run(AbsListView.java:3879)
                                                                      at android.os.Handler.handleCallback(Handler.java:739)
                                                                      at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                      at android.os.Looper.loop(Looper.java:148)
                                                                      at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

adding the activity to the manifest ->
<activity android:name="com.codinguser.android.contactpicker.ContactsPickerActivity"/> also works but produces the following error when calling the activity:

Caused by: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{b10679c 8231:test.contactpicker/u0a61} (pid=8231, uid=10061) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
                                                                      at android.os.Parcel.readException(Parcel.java:1599)
                                                                      at android.os.Parcel.readException(Parcel.java:1552)
                                                                      at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:3550)
                                                                      at android.app.ActivityThread.acquireProvider(ActivityThread.java:4778)
                                                                      at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2018)
                                                                      at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1468)
                                                                      at android.content.ContentResolver.query(ContentResolver.java:475)
                                                                      at android.support.v4.content.ContentResolverCompatJellybean.query(ContentResolverCompatJellybean.java:29)
                                                                      at android.support.v4.content.ContentResolverCompat$ContentResolverCompatImplJB.query(ContentResolverCompat.java:57)
                                                                      at android.support.v4.content.ContentResolverCompat.query(ContentResolverCompat.java:125)
                                                                      at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:59)
                                                                      at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:37)
                                                                      at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:296)
                                                                      at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:54)
                                                                      at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:42)
                                                                      at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:128)
                                                                      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
                                                                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
                                                                      at java.lang.Thread.run(Thread.java:818) 

even if <uses-permission android:name="android.permission.READ_CONTACTS" /> is added to the manifest (same with WRITE_CONTACTS)

@legalimpurity
Copy link

+1 same scenario

@codinguser
Copy link
Owner

This may be due to ProGuard, I'll look into it.
On Mar 28, 2016 17:25, "legalimpurity" [email protected] wrote:

+1 same scenario


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#10 (comment)

@manelv8
Copy link

manelv8 commented Jun 24, 2016

android M has a different permission mechanism. You have to do some think like this:

int permissionCheck = ContextCompat.checkSelfPermission(context, Manifest.permission.READ_CONTACTS);'
 if(permissionCheck != PackageManager.PERMISSION_GRANTED){
            ActivityCompat.requestPermissions(activity,
                    new String[]{Manifest.permission.READ_CONTACTS},
                    permissionCode);

@manelv8
Copy link

manelv8 commented Jun 24, 2016

Now I'm getting the following error:

java.lang.NoSuchFieldError: No static field fragment_container of type I in class Lcom/codinguser/android/contactpicker/R$id; or its superclasses (declaration of 'com.codinguser.android.contactpicker.R$id' appears in /data/app/br.ufc.lme.zikazero-1/base.apk)
                                                                         at com.codinguser.android.contactpicker.ContactsPickerActivity.onCreate(ContactsPickerActivity.java:51)

@codinguser codinguser self-assigned this Jun 29, 2016
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

6 participants