Fixed
Status Update
Comments
rm...@google.com <rm...@google.com> #2
Thank you for your feedback. Team may reach out for more feedback in reproducing or triaging this issue.
rm...@google.com <rm...@google.com>
rp...@google.com <rp...@google.com>
ku...@google.com <ku...@google.com> #3
Hi Kamil,
Can you please provide your Android Studio Build#. Also, can you please confirm "android:versionName="1.0" is shown in your open androidManifest.xml in APK view panel.
Did you get any warning messages like "Unable to retrieve application info from artifact"? Please provide your idea.log as well, if possible.
Thanks!
Can you please provide your Android Studio Build#. Also, can you please confirm "android:versionName="1.0" is shown in your open androidManifest.xml in APK view panel.
Did you get any warning messages like "Unable to retrieve application info from artifact"? Please provide your idea.log as well, if possible.
Thanks!
ka...@gmail.com <ka...@gmail.com> #4
Hi,
Thank you for response! Android Studio Build is as below:
Android Studio 3.3.2
Build #AI-182.5107.16.33.5314842, built on February 16, 2019
JRE: 1.8.0_152-release-1248-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.3
Using APK view directly in Android Studio I confirm that "android:versionName" is correctly displayed, without any warning messages. Only calling "apkanalyzer" from terminal returns "?" for some reason. File idea.log attached.
Thanks!
Thank you for response! Android Studio Build is as below:
Android Studio 3.3.2
Build #AI-182.5107.16.33.5314842, built on February 16, 2019
JRE: 1.8.0_152-release-1248-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.3
Using APK view directly in Android Studio I confirm that "android:versionName" is correctly displayed, without any warning messages. Only calling "apkanalyzer" from terminal returns "?" for some reason. File idea.log attached.
Thanks!
ku...@google.com <ku...@google.com> #5
There is an exception thrown due to 'assertNormalExitValue() ==0', as we got '1' when 'dumpbadging'.
ku...@google.com <ku...@google.com> #6
Well, exit code '0' is returned somehow(don't know why).
So the rest requires simple fix.
So the rest requires simple fix.
sh...@gmail.com <sh...@gmail.com> #7
I find the reason.
when set compileSdkVersion to 28 in build.gradle file. The apk's manifest file will add "android:compileSdkVersion" and "android:compileSdkVersionCodename" in manifest tag.
when use apkanalyzer get version name in commond line
apkanalyzer manifest version-name app-debug.apk
this commond will invode
aapt dump badging app-debug.apk
then call AndroidApplicationInfo.parseBadging(List<String> output) to parse badging info. (AndroidApplicationInfo.class in apkanalyzer.jar)
in this method, use pattern:
private static final Pattern packagePattern = Pattern.compile("package: name='(.*)' versionCode='(.*)' versionName='(.*)' platformBuildVersionName='(.*)'");
match badging package info.
but when compileSdkVersion is 28, the package info is:
package: name='com.shizy.sdkver' versionCode='1' versionName='1.0' compileSdkVersion='28' compileSdkVersionCodename='9'
so not matched.
that's the reason can't get version name use apkanalyzer in commond line.
when set compileSdkVersion to 28 in build.gradle file. The apk's manifest file will add "android:compileSdkVersion" and "android:compileSdkVersionCodename" in manifest tag.
when use apkanalyzer get version name in commond line
apkanalyzer manifest version-name app-debug.apk
this commond will invode
aapt dump badging app-debug.apk
then call AndroidApplicationInfo.parseBadging(List<String> output) to parse badging info. (AndroidApplicationInfo.class in apkanalyzer.jar)
in this method, use pattern:
private static final Pattern packagePattern = Pattern.compile("package: name='(.*)' versionCode='(.*)' versionName='(.*)' platformBuildVersionName='(.*)'");
match badging package info.
but when compileSdkVersion is 28, the package info is:
package: name='com.shizy.sdkver' versionCode='1' versionName='1.0' compileSdkVersion='28' compileSdkVersionCodename='9'
so not matched.
that's the reason can't get version name use apkanalyzer in commond line.
ku...@google.com <ku...@google.com> #8
#7
Thanks for commenting. Yes, you are right. However, I adopted another fix, leaving 'parseBadging' untouched. AS3.5 includes the fix. If you still see the issue, please let me know.
Thanks for commenting. Yes, you are right. However, I adopted another fix, leaving 'parseBadging' untouched. AS3.5 includes the fix. If you still see the issue, please let me know.
Description
Steps to reproduce:
Run following command using APK built with 3.3.2 gradle plugin:
apkanalyzer manifest version-name MyApp.apk
Result: returns "?"
Run the same command on APK built with 3.3.0 gradle plugin.
Result: returns valid version name from manifest (i.e. "1.0")
Gradle version: Reproduced on both 4.10.1 and 5.2.1
Android Plugin Version: 3.3.2
Module Compile Sdk Version: 28
Module Build Tools Version: 28.0.3
Android SDK Tools version: 26.1.1