apkanalyzer cannot parse the version name of my app - android

In a pipeline, I would like to extract from an APK I build the following information:
the version name of my app
the version code of my app
the application id of my app
According to this documentation, I can use the apkanalyzer command line tool in order to extract these information from my APK file.
First, I tried to get all these information with this commande line:
./apkanalyzer apk summary 'my.apk'
But the result is not the one I expect:
unknown 0 ?
So, I tried to use the manifest verb instead of the apk one:
./apkanalyzer manifest version-code 'my.apk'
2011100022
The result is the one I want. So I tried:
./apkanalyzer manifest application-id 'my.apk'
com.my.package
The result is the one I want too. To finish, I tried:
./apkanalyzer manifest version-name 'my.apk'
?
As you can, the result is not the one I want.
I laso tried to display the whole manifest using the command line:
./apkanalyzer manifest print 'my.apk'
In the result, into the <manifest /> tag, I can see the following attributes and values:
android:versionCode="2011100022"
android:versionName="1.5.6-API-29"
package="com.mypackage
So as you see, all the needed information are correctly displayed into the manifest.
Note that the APK is a release one and all the information are also correctly displayed in the "apkanalyzer UI tools" in Android Studio:
So my question is: how can I display correctly the version name of my app using the apkanalyzer command line?

Related

How can I change the app display name build with Flutter?

I have created the app using Flutter create testapp.
Now, I want to change the app name from "testapp" to "My Trips Tracker". How can I do that?
I have tried changing from the AndroidManifest.xml, and it got changed, but is there a way that Flutter provides to do that?
Android
Open AndroidManifest.xml (located at android/app/src/main)
<application
android:label="App Name" ...> // Your app name here
iOS
Open info.plist (located at ios/Runner)
<key>CFBundleDisplayName</key>
<string>App Name</string> // Your app name here
and/or
Don't forget to stop and run the app again.
UPDATE: From the comments this answer seems to be out of date
The Flutter documentation points out where you can change the display name of your application for both Android and iOS. This may be what you are looking for:
Preparing an Android App for Release
Preparing an iOS App for Release
For Android
It seems you have already found this in the AndroidManifest.xml as the application entry.
Review the default App Manifest file AndroidManifest.xml located in
/android/app/src/main/ and verify the values are correct,
especially:
application: Edit the android:label in the application tag to reflect the final name of the
app.
For iOS
See the Review Xcode project settings section:
Navigate to your target’s settings in Xcode:
In Xcode, open Runner.xcworkspace in your app’s ios folder.
To view your app’s settings, select the Runner project in the Xcode project
navigator. Then, in the main view sidebar, select the Runner target.
Select the General tab. Next, you’ll verify the most important
settings:
Display Name: the name of the app to be displayed on the home screen
and elsewhere.
There is a plugin called flutter_launcher_name.
Write file pubspec.yaml:
dev_dependencies:
flutter_launcher_name: "^0.0.1"
flutter_launcher_name:
name: "yourNewAppLauncherName"
And run:
flutter pub get
flutter pub run flutter_launcher_name:main
You can get the same result as editing AndroidManifest.xml and Info.plist.
You can change it in iOS without opening Xcode by editing the project/ios/Runner/info.plist <key>CFBundleDisplayName</key> to the String that you want as your name.
FWIW - I was getting frustrated with making changes in Xcode and Flutter, so I started committing all changes before opening Xcode, so I could see where the changes show up in the Flutter project.
Review the default app manifest file, AndroidManifest.xml, located in <app dir>/android/app/src/main
Edit the android:label to your desired display name
There are several possibilities:
1- The use of a package:
I suggest you to use flutter_launcher_name because of the command-line tool which simplifies the task of updating your Flutter app's launcher name.
Usage:
Add your Flutter Launcher name configuration to your pubspec.yaml file:
dev_dependencies:
flutter_launcher_name: "^0.0.1"
flutter_launcher_name:
name: "yourNewAppLauncherName"
After setting up the configuration, all that is left to do is run the package.
flutter pub get
flutter pub run flutter_launcher_name:main
If you use this package, you don't need modify file AndroidManifest.xml or Info.plist.
2- Edit AndroidManifest.xml for Android and info.plist for iOS
For Android, edit only android:label value in the application tag in file AndroidManifest.xml located in the folder: android/app/src/main
Code:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Your Application Name" //here
android:icon="#mipmap/ic_launcher">
<activity>
<!-- -->
</activity>
</application>
</manifest>
Screenshot:
For iOS, edit only the value inside the String tag in file Info.plist located in the folder ios/Runner .
Code:
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Your Application Name </string> //here
</dict>
</plist>
Screenshot:
Do a flutter clean and restart your application if you have a problem.
A few of the answers here suggest using the package flutter_launcher_name, but this package is no longer being maintained and will result in dependency issues within new Flutter 2.0 projects.
The plugin flutter_app_name (https://pub.dev/packages/flutter_app_name) is a nearly identical package that has sound null safety and will work with Flutter 2.0.
Set your dev dependencies and your app's name
dev_dependencies:
flutter_app_name: ^0.1.1
flutter_app_name:
name: "My Cool App"
Run flutter_app_name in your project's directory
flutter pub get
flutter pub run flutter_app_name
Your launcher will now have the name of "My Cool App".
You can change it in iOS without opening Xcode by editing file *project/ios/Runner/info.plist. Set <key>CFBundleDisplayName</key> to the string that you want as your name.
For Android, change the app name from the Android folder, in the AndroidManifest.xml file, android/app/src/main. Let the android label refer to the name you prefer, for example,
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<application
android:label="test"
// The rest of the code
</application>
</manifest>
You can change the Application name, by updating the name for both Android and iOS
for Android
just open AndroidManifest.xml file by,
go to inside android>app>src>main>AndroidManifest.xml
like this:-
so my application name is a "demo" so, I will update the label value.
same as for iOS
just open Info.plist file by,
go to inside ios>Runner>Info.plist
like this:-
And change this string value.
One problem is that in iOS Settings (iOS 12.x) if you change the Display Name, it leaves the app name and icon in iOS Settings as the old version.
For Android, change the app name from the Android folder. In the AndroidManifest.xml file, in folder android/app/src/main, let the android label refer to the name you prefer, for example,
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<application
`android:label="myappname"`
// The rest of the code
</application>
</manifest>
You can easily do this with rename package, It helps you to change your Flutter project's AppName and BundleId for different platforms, currently available for IOS, Android, macOS and Web
To install the package run the following command:
pub global activate rename
To rename the App, use the following command:
pub global run rename --appname "Your App Name"
That's It!
You can check the documentation of the package for full details because it has some nice features to choose the target platform and more.
As of 2019-12-21, you need to change the name [NameOfYourApp] in file pubspec.yaml. Then go to menu Edit → Find → Replace in Path, and replace all occurrences of your previous name.
Also, just for good measure, change the folder names in your android directory, e.g. android/app/src/main/java/com/example/yourappname.
Then in the console, in your app's root directory, run
flutter clean
in case you are releasing for multi-localizations (languages).
for Android:
in your app folder at
[appname]\android\app\src\main\res
add locale folders for example:
values-ar
valuse-en
then inside each folder add a new strings.xml that contains the app name in that language.
for ar
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="app_name">ادارة الديون</string>
</resources>
for en
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="app_name">debt management</string>
</resources>
The last thing you can do is go to your AndroidManifest.xml file
and set the android:label to the new files you have created.
android:label="#string/app_name"
I saw indeed the manual solution (to go to IOS and Android). But I found out a plugin which enables changing name from one single location:
https://pub.dev/packages/flutter_launcher_name
Just do the following:
Add to pubspec.yaml
dev_dependencies:
flutter_launcher_name: "^0.0.1"
flutter_launcher_name:
name: "yourNewAppLauncherName"
Run in Terminal:
flutter pub get
flutter pub run flutter_launcher_name:main
Done.
First
Rename your AndroidManifest.xml file
android:label="Your App Name"
Second
Rename Your Application Name in Pubspec.yaml file
name: Your Application Name
Third
Change Your Application logo
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/path/your Application logo.formate"
Fourth
Run
flutter pub pub run flutter_launcher_icons:main
If you like to automate stuff from command line like me, you can use this
appName="TestApp"
declare -a androidAppTypes=(
"main"
"debug"
"profile"
)
# Change app name for Android
for appType in ${androidAppTypes[#]}
do
xmlstarlet ed -L -u '/manifest/application/#android:label' -v "$appName" android/app/src/$appType/AndroidManifest.xml
done
# Change app name for Android
plutil -replace CFBundleDisplayName -string "$appName" ios/Runner/Info.plist
The way of changing the name for iOS and Android is clearly mentioned in the documentation as follows:
Build and release an Android app
Build and release an iOS app
But, the case of iOS after you change the Display Name from Xcode, you are not able to run the application in the Flutter way, like flutter run.
Because the Flutter run expects the app name as Runner. Even if you change the name in Xcode, it doesn't work.
So, I fixed this as follows:
Move to the location on your Flutter project, ios/Runner.xcodeproj/project.pbxproj, and find and replace all instances of your new name with Runner.
Then everything should work in the flutter run way.
But don't forget to change the name display name on your next release time. Otherwise, the App Store rejects your name.

Change Spotify apk name

I'm trying to change the name of the apk of spotify, but show me many dependencies to make this...
First I follow this manual: Change Package Names of APKs
On the first step, I found on
in manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.spotify.music" platformBuildVersionCode="24" platformBuildVersionName="7.0">
I modified by com.spotify.jair
On smali I modified the name of the folder smali/com/spotify/music
to Smali/com/spotify/jair
Search Lcom/spotify/music and replace
with Lcom/spotify/jair inside smali folder
After that, when I tried to install and the error:
Failure [INSTALL_FAILED_DUPLICATE_PERMISSION: Package com.spotify.jair attemptin
g to redeclare permission com.spotify.music.permission.SECURED_BROADCAST already
owned by com.spotify.music]
I modified all the com.spotify.music, inside AndroidManifest.xml to com.spotify.jair and the error is:
Failure [INSTALL_FAILED_CONFLICTING_PROVIDER: Package couldn't be installed in /
data/app/com.spotify.jair-1: Can't install because provider name com.spotify.mob
ile.android.mediaapi (in package com.spotify.jair) is already used by com.spotif
y.music]
So inside: res\values\ I found <string name="media_provider_authority">com.spotify.mobile.android.mediaapi</string> I modified: <string name="media_provider_authority">com.spotify.mobile.android.mediaapis</string>
And the error is:
6280 KB/s (35226422 bytes in 5.477s) Success
But the app does not open, and close inspected. Can anybody help me on the debug why the app is closing, Is there are a tool to debug why the app is closing?
Thanks!
Also to add this project tree:
Project Tree
I can't comment, the app is crashing, you need to take a logcat to see why
adb logcat > l0g.txt
Open Spotify
Unplug phone
And then upload that to paste bin

Google App Engine Python Upload Error

I am not sure why I am getting this error when trying to deploy my Python API via the Google App Engine Launcher.
Any Ideas what it is that I have going on here? Below is the error and my associated App.yaml file.
appcfg.py: error: Error parsing C:\Users\MYNAME\Desktop\Workspace\Imhotep\Imhotep\app.yaml: while parsing a block mapping
in "C:\Users\MYNAME\Desktop\Workspace\Imhotep\Imhotep\app.yaml", line 1, column 1
expected <block end>, but found '<block sequence start>'
in "C:\Users\MYNAME\Desktop\Workspace\Imhotep\Imhotep\app.yaml", line 14, column 2.
2013-11-17 20:37:33 (Process exited with code 2)
application: <IHAVEMYAPPIDHERE - PROVIDED BY GAE>
version: 1
runtime: python27
threadsafe: true
api_version: 1
handlers:
# Static assets
- url: /images
static_dir: static/images
# Endpoints handler
- url: /_ah/spi/.*
script: imhotep_api.APPLICATION
Whitespace is important in yaml files.
It looks like there's an extra space in front of the 2nd url line.
I'm not sure if the extra blank lines cause problems.
Oh, and if you're having problems deploying, it probably means you should have tested locally first.
I just noticed that in all of my app.yaml files threadsafe is set to 'yes' and not 'true'. Also, possibly more importantly, I have never seen the '.APPLICATION' extension in a .yaml file. In all of mine, and all the .yaml's I have seen it is '.app'.
Ex: script: imhotep_api.app
sorry if that's of no help.

new blackberry app world error "bar manifest file package version must be greater than ..."

I've started getting a weird error message when trying to upload a playbook app update to BlackBerry world. I think this problem started after installing version 1.6.1 of their eclipse plugin.
The error message:
"The package version in your .bar manifest file for signals_playbook must be greater than the previous version, but lower than any the next release version added to the vendor portal. . Your .bar manifest file package version must be greater than 3.0. Correct your .bar manifest file and try again to continue."
My AndroidManifest.xml contains:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ca.rcp.mobile.cror.signals"
android:versionCode="7"
android:versionName="3.1" >
The Manifest file contained within the BAR shows this info:
Archive-Manifest-Version: 1.1
Archive-Created-By: Apk2Bar version 1.6.1
Package-Author: xxxxxxxx
Package-Author-Id: some hash xxxxxxxxx
Package-Name: xxxxx.cror.signals
Package-Id: some hash xxxxxxxxx
Package-Version: 1.0.7.1
Package-Version-Id: some hash xxxxxxxx
Package-Type: application
Package-Architecture: armle-v7
Package-Author-Certificate-Hash: some hash xxxxx
Application-Name: Railway Signals
Application-Id: some hash xxxxxxxx
Application-Version: 1.0.7.1
Application-Version-Id: some hash xxxxxxxxxxx
Application-Requires-System: Tablet OS/2.0.0.7109
My system:
Windows 7 x64 using Eclipse 3.7.2 with latest ADT and updates.
I can see why BlackBerry world is complaining, it thinks the version number is 1.0.7.1. How do I get it to show 3.1.0.0??
I tried editing the manifest file contained within the bar, saving it and resubmitting. But that didn't work (didn't think it would but was worth a try).
Does anyone know where is the 1.0.7.1 coming from?
Can I override it?
Thanks
Rob
We suddenly started having the same problem with our builds. Evidently something changed in the BlackBerry build tools. Try setting the application's android:versionName attribute to a 4-part value (such as 3.1.0.1). BlackBerry has always used this format (major.minor.micro.build) for native apps. It seems that unless your Android manifest has the same format, the BlackBerry build tools fail to parse the versionName attribute and use a fall-back. From what I can tell, the fall-back is to use the value of android:versionCode as the micro version in a default application version code; that is it sets the app version in the .bar file manifest to
1.0.<android:versionCode value>.1
(I sure wouldn't want to be the engineer that had to defend implementing this behavior.)
An alternative approach is to create a custom manifest file that has the app version you want. Create a file named MANIFEST.MF in the same directory as AndroidManifest.xml. Then add the specific .bar manifest entries you want. For instance, it might be:
Archive-Manifest-Version: 1.1
Package-Version: 3.1.0.0
Application-Version: 3.1.0.0
Then open the project properties in Eclipse, navigate to BlackBerry, and for the "Custom BAR Manifest" drop-down, select "Add custom values (merge)".
Thank you, Ted!
There is another link on this topic;
http://supportforums.blackberry.com/t5/BlackBerry-World-Development/The-package-version-in-your-bar-manifest-file-for-New-Bundle/td-p/2754567
We started to notice problem after move to Gradle:
Before
AndroidManifest.xml:
android:versionCode="1312310309" android:versionName="2.28.4"
MANIFEST.MF:
Application-Version: 14.1231.309.0
After
AndroidManifest.xml:
android:versionCode="134" android:versionName="2.30.31402271059"
MANIFEST.MF
Application-Version: 1.0.134.0
I also had the same problem but I fixed it by adding this line in my Android Manifest file android:versionCode="30" previously I had android:versionCode="29" so upgraded it by one .And the problem got fixed for me.

Cyrillic app name incorrectly encoded during porting Android app to Blackberry

I have small problem with displaying cyrillic app name on PlayBook and BB10 simulator. Looks like it's incorrectly encoded from russian.
Problem appeared after updating bb eclipse plugin from version 1.3 to 1.5, with plugin v.1.3 it worked just ok.
I'll appreciate any help or ideas.
Here is screenshot from bb10 simulator:
I found workaround myself.
When I got problems with encodding with bb eclipse plugin, I decided to do the same thing with comandline tools.
After tools setup (sing keys, debug tokens, etc), I've tried to repackage my apk file with this command (source apk file was in apk/ folder and destination for bar file was bar/ folder)
./apk2bar apk/ -d bbplaybookdebugtoken.bar -t bar/ -a "zasadnyy" -cg
When I've got .bar file, I've installed it with command:
/batchbar-deploy bar/ 192.168.1.35 mysecretpass
Unfortunatelly result was unsuccsessful, app name was incorrectly encoded again. After first fail I've read documentation a bit more and tried to use this approach: http://developer.blackberry.com/android/documentation/creating_a_custom_manifest_file_2016828_11.htm...
When I unzipped bar file and opened MANIFEST.MS - I've found this line:
Application-Name: –ì–µ—Ä–æ–∏
According to documentation solution should be quite strainforward:
1. Rename MANIFEST.MS to <you apk name>.mf
2. Update incorrect properties, in my case I've changed line from above to "Application-Name: Герои"
3. Put edited manifest file in the same folder as <your apk name>.apk and rerun apk2bar tool with **-m** parameter, e.g.:
./apk2bar apk/ -d bbplaybookdebugtoken.bar -t bar/ -a "zasadnyy" -m -cg
Repackage, deploy, run and ..... and again FAIL. Application name was "–ì–µ—Ä–æ–∏".
After second fail, I decided to make dirty hack, I've edited MANIFEST.MF directly in repackaged bar file (Unzip -> edit manifest -> zip -> change file extension to .bar).
Deploy updated .bar file to playbook and .... YEAH, we've got cyrilic app name!
Conclusion and FIX:
Looks like in 1.5 release if apk2bar tool manifest encoding is misconfigured (in ver. 1.3 it worked just ok)
In oder to FIX issue: Unzip unsigned bar file -> edit manifest -> zip -> change file extension back to .bar
I had the same problem I believe, but the symptoms have been different. I was not even able to install the app on my test device and explicitly running blackberry-signer -verify confronted me with the Invalid signature file digest for Manifest. error.
The MANIFEST.MF file seems to be properly encoded in utf-8 by the apk2bar tool, but the following signing process seems to read this using the platform's default encoding. I added the following java parameter to the blackberry-signer.bat as well as the apk2bar.bat batch file scripts of the command line tools to make it work properly:
-Dfile-encoding=utf-8
(This is for version 1.5.2 of the tools)

Categories

Resources