Skip to content
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

Issue Cannot parse package #51

Open
matkt opened this issue Jul 11, 2019 · 5 comments
Open

Issue Cannot parse package #51

matkt opened this issue Jul 11, 2019 · 5 comments
Labels
Accepting PR's This issue is decently defined, happy to review pull requests to resolve it bug

Comments

@matkt
Copy link

matkt commented Jul 11, 2019

With the latest version of the plugin and even the previous versions I always have this error when launching the tests

Task :test-framework:testDebugComposer FAILED
[Thu Jul 11 10:37:37 CEST 2019]: Cannot parse test package from aapt dump badging $APK output.

@trevjonez
Copy link
Owner

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.

@rocboronat
Copy link

In case someone arrived here as I did, I did open an issue in composer with exactly this very issue: gojuno/composer#180

@trevjonez trevjonez reopened this Feb 17, 2021
@trevjonez
Copy link
Owner

Happy to see a PR on this if someone wants to take a swing at it.

@trevjonez trevjonez added Accepting PR's This issue is decently defined, happy to review pull requests to resolve it bug labels Feb 17, 2021
@trevjonez
Copy link
Owner

Given that I don't publish a fat jar of composer, is this even still a valid usecase?

@b-demuth
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepting PR's This issue is decently defined, happy to review pull requests to resolve it bug
Projects
None yet
Development

No branches or pull requests

4 participants