When I include PermissionsDispatcher code, my project fails to clean build with following error message:
Error:Execution failed for task ':sample:clean'.
Unable to delete file: C:PermissionsDispatcher-masterPermissionsDispatcher-master\samplebuild\intermediates\exploded-aarPermissionsDispatcher-master\library\unspecified\jars\lint.jar
If I remove this PermissionDispatcher code including from build.gradle file then everything working fine.
check #105 and wiki
@shiraji Thank you for your response. I updated my android studio with 2.0 beta 7, and now i can clean build my project, but now I got some of the warning messages as shown in attached screen shot. I can run the project successfully and without any issue but it gives me red lines in entire java files.

It states the issue right in the tooltip: In your class annotated with @RuntimePermissions, you need to override onRequestPermissionResult() and invoke the generated PermissionsDispatcher method of the same name.
Yes I am overriding onRequestPermissionResult() and calling generated PermissionsDispatcher method already, can you please suggest another solution ?
could you give us a sample code?
Here is the entire project that I am trying to build a sample project for run-time permissions.
Permission.zip
I am not able to reproduce this warning...could you give me a step to reproduce this error?
I ran ./gradlew clean lintDebug and also executed lintDebug from Android Studio. didn't get any errors. (16 warnings which are not related to PermissionsDispatcher)
My Android Studio version is 2.1 preview4.
Yes I am also not getting any error, project run successfully without any issue. But it shows annoying red lines in entire java files as shown in above attached screen shot. Again attaching the screen shot, please check it below.

I am using Android Studio version is 2.0 Beta 7
I have no clue if you don't give me the steps to reproduce this error.
BTW, have you tried Invalidate Caches / Restart...?
Actually there is no any steps to re-produce it, I just include permission dispatcher in build.gradle files and id necessary coding and then just did the clean build and I got these error red lines.
I also did the invalid caches/Restarts but it didn't help me. If you have any idea why it is telling me onRequestPermissionsResult is not called even though I am overriding it in my fragment, then can you please help me?
You didn't get this red lines ?
You didn't get this red lines ?
No. That's why I ask you how to do it.
You may have change lint configurations which I don't know about. How did you show the custom lint result on the editor, like inspection? (and the result is not right one...)
I think It has an issue with https://github.com/hotchemi/PermissionsDispatcher/blob/master/lint/src/main/java/permissions/dispatcher/CallOnRequestPermissionsResultDetector.java - last methof afterVisitClassDeclaration but don't know what you are doing over there and what is missing in my code so it is showing lint error. As you have worked on permission dispatcher, you have better idea on it what is missing.
I think It has an issue with https://github.com/hotchemi/PermissionsDispatcher/blob/master/lint/src/main/java/permissions/dispatcher/CallOnRequestPermissionsResultDetector.java - last methof afterVisitClassDeclaration but don't know what you are doing over there and what is missing in my code so it is showing lint error. As you have worked on permission dispatcher, you have better idea on it what is missing.
Well, if that the case, then we should get an error when we ran ./gradlew lintDebug
For instance, if I commented out onRequestPermissionsResult and run ./gradle lintDebug
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
// NOTE: delegate the permission handling to generated method
// CameraFragmentPermissionsDispatcher.onRequestPermissionsResult(this, requestCode, grantResults);
}
I get this error message
...
:app:lintDebug
Wrote HTML report to file:///Users/isogai_yoshinori/Downloads/Permission/app/build/outputs/lint-results-debug.html
Wrote XML report to file:///Users/isogai_yoshinori/Downloads/Permission/app/build/outputs/lint-results-debug.xml
Lint found 1 errors and 16 warnings
:app:lintDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintDebug'.
> Lint found errors in the project; aborting build.
Fix the issues identified by lint, or add the following to your build script to proceed with errors:
...
android {
lintOptions {
abortOnError false
}
}
...
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
And the error description is following
<issue id="NeedOnRequestPermissionsResult" severity="Error" message="Generated onRequestPermissionsResult method not called" category="Correctness" priority="5" summary="Call the "onRequestPermissionsResult" method of the generated PermissionsDispatcher class in the respective method of your Activity or Fragment" explanation="You are required to inform the generated PermissionsDispatcher class about the results of a permission request. In your class annotated with @RuntimePermissions, override the "onRequestPermissionsResult" method and call through to the generated PermissionsDispatcher method with the same name." errorLine1="@RuntimePermissions " errorLine2="^">
<location file="/Users/isogai_yoshinori/Downloads/Permission/app/src/main/java/com/taim/fragments/CameraFragment.java" line="27" column="1"/>
</issue>
which is what you get.
I felt like that is an issue with Android Studio, not PermissionsDispatcher or lint, like I said at the beginning. So, unless, you provide me how to show a custom line error on the editor, I won't be able help you.
I think we should reopen this issue.
@hotchemi reproduced this problem in Android Studio 2.1 pre4, too. I haven't, yet...maybe my lint environment is not normal since I was working on the lint.
I really have no idea why this happens in some people's environment except mine. Still thinking this is a bug of Android Studio.
I set lint dependancy https://github.com/shiraji/PermissionsDispatcher/commit/cb34f322edee330a28de87a99bd4d7730572c6db Could you test it thou jitpack.io, @Smeet123 ?
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0-alpha4'
//For runtime permission library
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app/build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
//For runtime permission library
// compile 'com.github.hotchemi:permissionsdispatcher:2.1.0'
// apt 'com.github.hotchemi:permissionsdispatcher-processor:2.1.0'
compile 'com.github.shiraji.permissionsdispatcher:permissionsdispatcher:cb34f322ed'
apt 'com.github.shiraji.permissionsdispatcher:permissionsdispatcher-processor:cb34f322ed'
}
Ok sure I will give a try and let you know dear :)
@Smeet123 @shiraji We released 2.1.1(delete above lint check as an emergency correspondence). For the time being please use it. Thx!
@shiraji @hotchemi None of the both approaches solve this issue. Changed build.gradle (module & app level) as suggested by @shiraji and also tried new 2.1.1 library as suggested by @hotchemi, but both failed to resolve this red line issue.
Thanks for testing the module, @Smeet123 .
This result piss me off...what does v2.1.1 module's error say? the same error message?
@shiraji Yes same error.
@Smeet123 Have you tried clean?
@hotchemi Yes did all possible solutions but still same issue.
I changed lint scope. Could you try this?
Here is the diff
https://github.com/hotchemi/PermissionsDispatcher/compare/7370ee260310385ce7da6aa95d7d6a361771501f...shiraji:c79f0cf2c7163bab7d71db520160f4496e648e7d
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0-alpha4'
//For runtime permission library
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app/build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
//For runtime permission library
// compile 'com.github.hotchemi:permissionsdispatcher:2.1.0'
// apt 'com.github.hotchemi:permissionsdispatcher-processor:2.1.0'
compile 'com.github.shiraji.permissionsdispatcher:permissionsdispatcher:c79f0cf2c7'
apt 'com.github.shiraji.permissionsdispatcher:permissionsdispatcher-processor:c79f0cf2c7'
}
Hi @shiraji. I have the same problem, but it looks ok with the changed lint scope.
Thanks @bffcorreia
How about you, @Smeet123 ?
And some guys reported that using "invalidate cache" in Android Studio may solve the problem.
My current workaround is to add a private class.
Then only that class gets the red line. Atleast it lets me read my code for now. Hope to get rid of it soon.
public class MainActivity extends AppCompatActivity {
private class RemoveRedLines {}
}
@robertbakker Have you tried https://github.com/hotchemi/PermissionsDispatcher/issues/124#issuecomment-206122856 ?
@hotchemi I tried File->Invalidate Caches/Restart , which did not solve the problem
and the patch posted above, which Gradle couldn't build for me (sorry, I don't have the Gradle error anymore)
Using Android Studio 2.1 preview 5
Application is working fine and red lines gone by changing gradle files as shown above. Thank you so much all members. Very happy to see this issue resolved now.
Most helpful comment
Application is working fine and red lines gone by changing gradle files as shown above. Thank you so much all members. Very happy to see this issue resolved now.