Firstly, I'm trying to do an update over an old apk on play store,
And I'm curious if the generated signed apk with the default name "app-release"
Should i rename that to the same name as my new apk com.site.radio?
What I mean..
I have generated a signed apk but it's named "app-release" by default,
I'd like to change that name to the same name as my package: com.site.radio
I've tried putting this in the build.gradel:
project.ext.set("archivesBaseName", "com.site.radio");
But when I generate a new signed apk it's name becomes:
com.site.radio-release
How do you remove the -release part?
Thanks in advance
Related
I build apk file with help of https://build.phonegap.com/apps/ portal evrey time I build debug or release apk file the names are:
______debug.apk or ______release.apk
I want to change the name of the release apk to something more significant, for example MyProject-v2.apk.
Any idea how can I change the name of the the apk file when it build?
No, sadly you cannot control the file name in the config.xml, but the file name doesn't matter. In the config.xml, you specify the name of your app as it will appear to the users on their mobiles, and that's what matters.
If you like to give the file a specific name for your own file management (which is what I do too), you'll have to manually rename the file every time you create a new build.
The thing you should know is that APK names does not matter in its file name, What matters is what you said in the AndroidManifest.xml in the Application label:
android:label="#string/app_name"
This is the only app name and it can even be different from package name so the apk being called ______debug.apk or ______release.apk doesnt matter it is just to differenciate if it is debug or release. You can just rename it just like any file in your computer even Michael.apk. And still all android phones will ignore the file names and go get the label at android:label="#string/app_name" so just copy the file and change it to anything you want and it works.
You can rename it as a file.
The installed apk name is same as what you defined in manifest.
You can configure naming of you builds in gradle configuration
Add this to your android{} close in your module's build.gradle:
// determine the apk file name when produced
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(
output.outputFile.parent,
output.outputFile.name.replace("app", "YourAppNameHere-V${variant.versionName}"))
}
}
the V is for the version number.
Inside modules build.gradle file, add following line to android { defaultConfig { X } }
setProperty('archivesBaseName', "YourAppName-$versionCode")
In my case I just renamed the file app_release.apk to appname.apk
and it works for me.
Same for app_debug.apk to appname_debug.apk
In project directory:
While Installing
You cannot control the file name in the config.xml. But if you have a self signed certificate and want to rename the apk, you can do it with zipalign:
zipalign.exe -v 4 platforms\android\app\build\outputs\apk\release\app-release-unsigned.apk platforms\android\app\build\outputs\apk\release\YouyAppName-v2.apk
I inherited an android app that was initially outsourced to an external developer, fixed stuff and I am now ready to send the new update to the play store.
Then I found out that I need a specific signing key in order to update the app, which we got from the previous developer.
So I generated a signed release apk using the key I got and tried to upload. Upon uploading, I get a pop-up with an error. see screenshot for details
We asked the developer if he was sure that was the key he used, and he swears he looked everywhere and its the only key he used. Although, I do think he might have changed the password for it..., not really sure.
Significant changes I introduced to the app is changing the package in manifest and creating product flavours which each their own package name(one of them got to keep the original package name from the play store).
Some things I noticed: When I got the app, the app manifest had an out-commented package name and a new one with our company's name in it. The original one had the name of the of the outsourcing company in place of the "example" of the "com.example.appname" bit, so they must have changed the package name when they created the release apk.
I have no idea if any of this means anything because the package name is the same when I put it all in an apk... It's just that the store claims that the app was signed with a different certificate and the previous developer swears he used the same he sent to us.
Can anyone tell me if it's possible to do anything to make this work, or are we completely doomed and will have to upload a new app to the store?
Thanks for any help.
Update:
Because people are asking about packagename, let me clarify.
When I got the app, all the packagenames in the manifest was not the same as the one from Playstore... so i refactored the entire package app-wide to reflect the play-store package name... and then I introduced product flavours because we need a new app with different branding that is similar to the original one... so I ended with with a structure like this:
defaultConfig {
applicationId "PlayStorePackagName"
}
productFlavors {
brand1 {
applicationId "PlayStorePackagName" //<- for original app
}
new_brand{
applicationId "NewPlayStorePackagName" //<- for new app.
}
}
In this case, it shouldn't matter what package name is in the manifest, should it?
You cannot change the package name nor the Certificate for the App for the Playstore! If you don't have the correct certificate you cannot submit your App as an update to the existing one.
Certificate checking
However you can check the information stored in your available Keystore and compare it with the current store apk. For Example:
jarsigner -verify -verbose -certs yourapp.apk
You can get more details with the keytool. See this Thread for more information.
Package name
You can check the correct package name for your app when Browsing to your App in the play store.
Example for Google Plus: https://play.google.com/store/apps/details?id=com.google.android.apps.plus
id=com.google.android.apps.plus is the package name in this case. This cannot be changed for your App
However this package name is defined by your applicationId within your App. Your structure of your app can have different package names. See here for more information.
From the docs:
When you're ready to make changes to your APK, make sure to update your app’s Version Code as well so that existing users will receive your update.
Use the following checklist to make sure your new APK is ready to update your existing users:
The Package Name of the updated APK needs to be the same as the current version.
The Version Code needs to be greater than that current version. Learn more about versioning your applications.
The updated APK needs to be signed with the same signature as the current version.
To verify that your APK is using the same certification as the previous version, you can run the following command on both APKs and compare the results:
$ jarsigner -verify -verbose -certs my_application.apk
If the results are identical, you’re using the same key and are ready to continue. If the results are different, you will need to re-sign the APK with the correct key.
You say that:
Significant changes I introduced to the app is changing the package in manifest
So this is the source of issue. You'll need to use the same package name.
I planned to change the package name through smali(reverse)
when I open up apktool.yml, I saw this
forced-package-id: '127'
I have tried to change it but it crash
why should i do?
Assuming your goal is to rename the package name of the apk, the package names used for the classes are irrelevant. The package name of the apk is mostly unrelated to the package names of any classes in the apk. And there's no reason you need to touch the package id.
I would recommend unpacking the apk with apktool, and then edit the apktool.yml, setting renameManifestPackage to the new package name. Then when you rebuild the apk with apktool, it should use aapt's --rename-manifest-package functionality to change the package name.
After that, just resign the new apk and you should be good to go.
apktool d app.apk
// change "renameManifestPackage: null" in app/apktool.yml
// to "renameManifestPackage: my.new.package"
apktool b app -o new_app.apk
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/my.keystore new_app.apk mykeyname
And just to reiterate, you don't need to modify the package names of any classes.
To my knowledge there are no fast ways to change the package name.
You have to change the package="com.mycompany.myapp" in Manifest.xml and then manually replace all the package name occurrences in smali files (and folders). Finally edit apktool.yml replacing the old package name, with your new package name.
A full detailed tutorial can be found here: http://forum.xda-developers.com/showthread.php?t=2760965
I've tried different approaches but the most reliable for me has been the method described here:
https://forum.xda-developers.com/t/how-to-guide-mod-change-package-names-of-apks.2760965/
These are the steps:
Decode APK (using apktool)
Edit apktool.yml
Edit AndroidManifest.xml
Rename smali subfolders
Search & Replace *.smali (using Notepad++)
Build APK (using apktool)
Sign APK (using apksigner)
Tools needed:
Apktool - https://ibotpeaches.github.io/Apktool/
Notepad++ - https://notepad-plus-plus.org/downloads/
apksigner - https://developer.android.com/studio/command-line/apksigner
Download apktool and wrapper script to C:\apktool.
Let's assume you want to modify from/to as specified here:
From: XVipreSettings.apk (Package name: com.xvipre.settings)
To: ModdedApp.apk (Package name: com.modded.app)
1. Decode APK (using apktool)
apktool.bat d XVipreSettings.apk
2. Edit apktool.yml
apkFileName: XVipreSettings.apk
...
renameManifestPackage: null
is changed to:
apkFileName: ModdedApp.apk
...
renameManifestPackage: 'com.modded.app'
3. Edit AndroidManifest.xml
package="com.xvipre.settings"
is changed to:
package="com.modded.app"
4. Rename smali subfolders
move .\XVipreSettings\smali\com\xvipre\settings .\XVipreSettings\smali\com\xvipre\app
move .\XVipreSettings\smali\com\xvipre .\XVipreSettings\smali\com\modded
5. Search & Replace *.smali
Start Notepad++
Menu > Search > Find in Files... (Ctrl+Shift+F)
Find what : "Lcom/xvipre/settings"
Replace with : "Lcom/modded/app"
Filters : "*.smali"
Directory : "C:\apktool\XVipreSettings\smali\com"
Press Replace in Files (may take a few minutes)
6. Build APK
apktool.bat b XVipreSettings -o ModdedApp.apk
7. Sign APK
(I'm assuming 31.0.0 here yours may be different, also if you don't want to sign using debug certificate you need to modify this step accordingly)
%homedrive%%homepath%\AppData\Local\Android\Sdk\build-tools\31.0.0\apksigner.bat sign --ks %homedrive%%homepath%\.android\debug.keystore --ks-pass pass:android --key-pass pass:android C:\apktool\ModdedApp.apk
After "phonegap build android" command,i searched .apk file on D:\firstapp\platforms\android\ant-build but i found only the CordovaApp-debug.apk and CordovaApp-debug-unaligned.apk file...
where can i get my .apk file, Also my app name if firstapp, still only CordovaApp-debug.apk file found..
Actually i'm new to phonegap, help me...
You found the right apk. Cordova is the new name for Phone Gap. CordovaApp-debug.apk is your apk. The -debug part means that it was signed with the default debug key.
You need to sign it with your own key when you upload the apk to Google Play. But for now, you can use the current apk you have to test it on your own device, or on your friends devices.
Cordova has changed name fixed to CordovaApp to avoid issues with unicode app name (https://issues.apache.org/jira/browse/CB-6511)
If your application name is normal (A..z) you can revert this behaviour by changine line 217 of C:\Users\.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\lib
from:
var safe_activity_name = "CordovaApp"
to:
var safe_activity_name = project_name.replace(/\W/g, '');
CordovaApp-debug.apk is your .apk, cordova will not generate apk with your application name. It will be "CordovaApp-debug.apk"
According to the 'help' target documentation:
debug: builds the applications and
signs it with a debug key
release; builds the application: the
generated APK file must be signed
before it is published
Here is what I found, which is a bit different than what I expected:
debug: ignores keystore definitions in build.properties whether you specify them or not. Which kesystore file is it using? The same as Eclipse: the default debug.keystore file in your Documents and Settings?
It creates two files:
-debug-unaligned.apk (signed, unaligned)
-debug.apk (signed, aligned)
release: 'help' says it doesn't sign it. It creates these files:
-unsigned.apk (unsigned, unaligned)
The next two are only if you have the values specified in build.properties:
-unaligned.apk (signed, unaligned)
-release.apk (signed, aligned)
Any helpful comments / verifications will be greatly appreciated.
Which kesystore file is it using? The same as Eclipse: the default debug.keystore file in your Documents and Settings?
Yes.
As far as the release target goes, you will get behaviour like this:
If you have lines like:
key.store=c:/users/me/my-release-key.keystore
key.alias=release_alias
key.store.password=myStorePassword
key.alias.password=myAliasPassword
in your build.properties, it will automatically build and sign your apk with no prompting for anything.
If you comment out the last two lines, then it will prompt you for the passwords, then complete a signed build if the passwords are OK.
If you don't have any of the above lines, then it will just build you an unsigned apk with no prompting for anything and end with:
-release-nosign:
[echo] No key.store and key.alias properties found in build.properties.
[echo] Please sign C:\dev\projects\AntBuilds\MyProject\bin\MyProject-unsigned.apk manually
[echo] and run zipalign from the Android SDK tools.
.
This answer works for me, I am using ant to auto-compile android app, it prompts and need password, I wrote one file named password, and using the command ---ant release < passwd,
However, it also prompts that I need input password.
Using the tips here
key.store=c:/users/me/my-release-key.keystore
key.alias=release_alias
key.store.password=myStorePassword
key.alias.password=myAliasPassword
I solved this problem.