-
-
Notifications
You must be signed in to change notification settings - Fork 124
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
String index out of range: -1 in task analyzeClassUsageDebug #490
Comments
I tried putting in an obvious fix: But after running again that lead to a new error:
So tried a second fix, this time allowing the code to continue with a blank extension: But got the same error.
And now I've realised that's because the next step is to parse any file inside the layouts folder as XML which this file isn't... Perhaps this needs filtering out at an earlier stage? Let me know if you have any ideas :-) |
Also tried adding a filter here (line 46), which let's you move onto the next stage but still leaves the (PROJECT) file inside the
|
Perhaps that is the fix, and the root node issue a new genuine issue?
is that applicable here? |
Thanks for the issue and the other information. It looks like an assumption I made doesn't hold for all situations. I haven't had time to go through all your comments, but it looks like something that should be addressed. I'll respond more completely later. |
You're onto something with trying to filter the files that get into the layouts collection. What is confusing me is that I tried to write a test for this and got this Android error:
So I actually don't understand how you got yourself into this situation to begin with 😅 |
hmmm the only diff I have from master is work around for #483 to get results: perhaps I should investigate that issue more first 😊 |
The analysis is set running now, (after taking the change that resolved #483) so I should hopefully be able to confirm if this is an issue or not Monday. |
Still getting this issue with the latest off master.
I added logs again to double check:
|
I've reread your messages and I understand now! Sorry I thought that was an in project issue, not an Android issue. Right! We have this in our build to get around it:
Kotlin DSL
I can see (Or you can set the Environment Variable |
Interesting! I wasn't aware of the FYI, you can do this with Groovy DSL: tasks.withType(MergeResources).configureEach {
aaptEnv.set("^PROJECT")
} I don't believe you need the afterEvaluate. And you certainly don't need it nested inside of |
Ah thanks! I took it from a plugin where it looked different and manually
added the android to try and make it more contextual 😁 heh
…On Mon, 11 Oct 2021, 19:27 Tony Robalik, ***@***.***> wrote:
Interesting! I wasn't aware of the aaptEnv property on the MergeResources
task.
FYI, you can do this with Groovy DSL:
tasks.withType(MergeResources).configureEach {
aaptEnv.set("^PROJECT")
}
I don't believe you need the afterEvaluate. And you certainly don't need
it nested inside of android (that nesting is meaningless).
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#490 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFAD5B4J6LWZDPFHMCFBXLUGMUABANCNFSM5FCFSXUA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I've decided that getting the regression test to work is not worth the effort 🙃. The PR will be merged if green. |
Issue resolved. |
Build scan link
Sorry, can't share publicly :)
Plugin version
0.78.0
Gradle version
7.1.1
(Optional) Android Gradle Plugin (AGP) version
7.0.0
Describe the bug
Exception
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
To Reproduce
Steps to reproduce the behavior:
projectHealth
on a specific module(note we have several hundred modules, and this only happens on 1 of them)
Expected behavior
Not crash.
Additional context
stacktrace:
I added some debug to see what file it is failing on
we have a file (
PROJECT
) in the folder which is basically who can commit / who has to authorise changes to that sub tree. It doesn't have an extension.I'll see if I can make a PR
The text was updated successfully, but these errors were encountered: