Open matkt opened 5 years ago
This is actually going to be an issue for composer issue. I make no effort to use AAPT to parse package info in the plugin because the plugin can pull it directly from the data model that produces the APK.
It seems that if arguments for package name are sent to composer is should skip trying to parse them from the APK?
Im going to close for now and urge you open the issue with the composer repo directly.
In case someone arrived here as I did, I did open an issue in composer with exactly this very issue: https://github.com/gojuno/composer/issues/180
Happy to see a PR on this if someone wants to take a swing at it.
Given that I don't publish a fat jar of composer, is this even still a valid usecase?
I hit a similar issue today, manifesting itself with the error message "Cannot parse test package from aapt dump badging $APK output." as well. After remote debugging composer, it turned out that this was caused by the String "package" being contained in the absolute path of my working directory.
The way that Composer parses the aapt output file is not very robust, it looks like this:
output.readText()
.split(System.lineSeparator())
// output format `package: name='$testPackage' versionCode='' versionName='' platformBuildVersionName='xxx'`
.firstOrNull { it.contains("package") }
?.split(" ")
?.firstOrNull { it.startsWith("name=") }
?.split("'")
?.getOrNull(1)
?.let(TestPackage::Valid)
?: TestPackage.ParseError("Cannot parse test package from `aapt dump badging \$APK` output.")
Since the second line of the aapt output file echoes the executed aapt command including the absolute path of the examined test.apk, the above code misread this line and expected it to contain the package name which it didn't.
With the latest version of the plugin and even the previous versions I always have this error when launching the tests