permissions-dispatcher / PermissionsDispatcher

A declarative API to handle Android runtime permissions.
https://github.com/permissions-dispatcher/PermissionsDispatcher
Apache License 2.0
11.22k stars 1.44k forks source link

Annotation processors must be explicitly declared now in 4.0.0 #535

Closed neooleg closed 5 years ago

neooleg commented 5 years ago

Overview

Expected

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')

    //....

    // Retrofit

    // RxJava

    // PermissionsDispatcher
    implementation "com.github.hotchemi:permissionsdispatcher:4.0.0"
    annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:4.0.0"
}

Actual

Annotation processors must be explicitly declared now.  The following dependencies on the compile classpath are found to contain annotation processor.  Please add them to the annotationProcessor configuration.
  - permissionsdispatcher-processor-4.0.0.jar (com.github.hotchemi.permissionsdispatcher:permissionsdispatcher-processor:4.0.0)
Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior.  Note that this option is deprecated and will be removed in the future.
See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.

Environment

library version: 4.0.0 gradle plugin: 3.1.4 (4.4) Android Studio: 3.1.4 Compile SDK: 28 TargetSDK: 26

Reproducible steps

neooleg commented 5 years ago

After a lot of investigation found the reason -- it's JitPack.

However, there is note in docs and I did read it before start using, but it's totally unclear.

If you include Jitpack.io dependencies in your project, it is important to review the order of the repositories available to your app module
Because of the library's artifact ID, Jitpack might be tempted to resolve the dependency on its own, which could lead to an error during Gradle's configuration time

Can you add more info, e.g.:

garastard commented 5 years ago

Try to change repositories in gradle file

replace this line maven { url 'https://jitpack.io' } on this line maven { url 'https://maven.google.com/'}

hotchemi commented 5 years ago

https://github.com/permissions-dispatcher/PermissionsDispatcher/issues/535#issuecomment-432031677 would resolve the problem I suppose!

neooleg commented 5 years ago

@garastard thanks a lot for your advice, however, it doesn't work in this way.

In bottom line how it was fixed.

Before it was

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
        maven { url 'https://maven.google.com' }
        mavenCentral()
        jcenter()
        google()
    }
}

To fix it become

allprojects {
    repositories {
        maven { url 'https://maven.google.com' }
        mavenCentral()
        jcenter()
        maven { url "https://jitpack.io" }
        google()
    }
}

Do you know how to fix it in proper way?

hotchemi commented 5 years ago

your fix is ok https://github.com/permissions-dispatcher/PermissionsDispatcher/issues/35#issuecomment-235432557

neooleg commented 5 years ago

Thanks for the feedback, @hotchemi !

Although, it would be great to understand how to replace jitpack with https://maven.google.com/

hotchemi commented 5 years ago

sorry I don't undersand..is it related to this lib?

neooleg commented 5 years ago

I meant if there is fix to allow PermissionsDispatcher 4.0.0 works without jitpack -- it will be great.

hotchemi commented 5 years ago

PD doesn't rely on jitpack at all?🤔

neooleg commented 5 years ago

No, but jitpack affects it somehow, right?

That's why the issue appeared.

On Tue, Oct 23, 2018 at 5:47 PM Shintaro Katafuchi notifications@github.com wrote:

PD doesn't rely on jitpack at all?🤔

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/permissions-dispatcher/PermissionsDispatcher/issues/535#issuecomment-432275930, or mute the thread https://github.com/notifications/unsubscribe-auth/ABkhyckLEbKf9I_KQK_7YNzd0OUR7Lshks5unyv6gaJpZM4Xzzes .

-- Best regards, Oleg

hotchemi commented 5 years ago

Sorry I don't understand..what you should do is to declare jcenter before jitpack and that's like general problem among jitpack and gradle. If you want to know more detail go to stackoverflow and google.

neooleg commented 5 years ago

OK, sure. I just didn't understand the advice from @garastard, hence, clarified.

Sorry for that... Once again -- thanks for help.

hotchemi commented 5 years ago

👍👍👍

26shruti commented 5 years ago

Getting same issue, when running job on jenkins machine. Jenkins machine is configured to run on sdk alone. Does this have to do something with the issue?

hotchemi commented 5 years ago

@26shruti check https://github.com/permissions-dispatcher/PermissionsDispatcher/issues/535#issuecomment-432465783 and from 4.2.0 we changed groupId so this kind of problem never happens.

26shruti commented 5 years ago

@hotchemi tried that. It didn't help. Instead solved the issue adding annotationProcessor 'com.github.hotchemi:permissionsdispatcher:4.0.0' along with annotationProcessor 'com.github.hotchemi:permissionsdispatcher-processor:4.0.0'

hotchemi commented 5 years ago

@26shruti supposedly your workaround doesn't work since it means you don't add library module to your app binary. And we recommend to go to stackoverflow if you're stuck.