You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since it checks the file is Groovy file, there is no way to work with
Java file.
Because it requires to navigate to build.grale, now it checks the file
has "apply plugin: 'com.android.application'" in order to differenciate
$PROJECT/build.gradle file.
@@ -69,8 +77,6 @@ class AddPMDependencies : CodeInsightAction() {
69
77
}
70
78
}
71
79
72
-
if (file !isGroovyFile) return
73
-
74
80
val version = androidGradleVersion
75
81
when {
76
82
version ==null->
@@ -86,7 +92,7 @@ class AddPMDependencies : CodeInsightAction() {
86
92
"No annotation processing settings found. Use 'android gradle plugin version >= 2.2' or 'android-apt'",
87
93
NotificationType.WARNING))
88
94
else-> {
89
-
val dependenciesBlock =file.findDescendantOfType<GrMethodCallExpression> { it.invokedExpression.text =="dependencies" } ?:return
95
+
val dependenciesBlock =targetFile?.findDescendantOfType<GrMethodCallExpression> { it.invokedExpression.text =="dependencies" } ?:return
90
96
val factory =GroovyPsiElementFactory.getInstance(project)
91
97
val aptRef =when {
92
98
useKapt ->"kapt"
@@ -95,9 +101,10 @@ class AddPMDependencies : CodeInsightAction() {
95
101
}
96
102
val compileExpression = factory.createExpressionFromText("compile 'com.github.hotchemi:permissionsdispatcher:${PdVersion.latestVersion}'")
97
103
val annotationProcessorExpression = factory.createExpressionFromText("$aptRef 'com.github.hotchemi:permissionsdispatcher-processor:${PdVersion.latestVersion}'")
0 commit comments