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
Related
Using Xamarin.Android 10.3 I'm trying to sign a Release package from Visual Studio 16.6.5. In order not to include the password as plaintext on the csproj file, I've added a file in the project folder called Pass.txt and exluded it in the git.ignore file
But when it comes to the signing process it fails with:
Failed to load signer "signer #1"
java.io.IOException: Failed to read Key "myapp" password for signer #1 : end of file reached in C:\Users\myuser\source\repos\MyApp.Xamarin\Pass.txt
If I remove the file:Pass.txt and past the password it works fine.
According to this release we can use file: in Xamarin 10.1 an later.
<PropertyGroup>
<AndroidSigningStorePass>file:C:\Users\Windows User\AndroidSigningPassword.txt</AndroidSigningStorePass>
<AndroidSigningKeyPass>file:C:\Users\Windows User\AndroidSigningPassword.txt</AndroidSigningKeyPass>
</PropertyGroup>
Missed "Note that if the same file is specified for both settings, the file must contain two lines. The first line must be the keystore password, and the second line must be the alias password. – Fritjof Berggren just now"
Adding the password twice on the file fixed it
Sometimes the issue just fixes and you well never know how.
This is what I did and it is fixed.
Goto Tools>> Android >> Android ADB Command Prompt
Type C:\Android\SDK>adb remove {your Package Name}
Clean Project
Build in Release Mode
after that clean and rebuild in Debug mode.
For me this issue was that I have the folder in One Drive and I have set the option for saving space, so I just have the link in my machine,as soon as I download the file, it works
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"
android project with files in assets, these file need encrypt before generator apk
every times i changed some file in assets,
i need copy out these file , encrypt ,then copy into assets
what i want is:
keep file in assets not encypt (can edit it conveniently) ,
but file in .apk encrypted
encrypt work do automatically by gradle.build
my basic idea is thad add some task before mergeDebugAssets (or mergeReleaseAssets)
before mergeDebugAssets, i replace all file in file://$MODULE_DIR$/build/assets
code like below
task processAssetFile {
// code : replace file in build/assets
}
mergeDebugAssets.dependsOn processAssetFile
the problem is
mergeDebugAssets is not available in gradle.build
error log below:
Could not find property 'mergeDebugAssets' on project ':gradle'.
so is there some idea can achieve my goals ?
android studio ver :0.52
You can always find the task by its name.
I would also suggest that you want to perform encryption for other build variants (makes sense for release even more than for debug).
This requires a little bit of coding since you need to create a task for each variant, too.
It is best to create those tasks dynamically so you don't forget a variant.
Say you're encrypting with some command-line tool, the code you need to add could look like this:
android.applicationVariants.all { variant ->
String suffix = variant.variantData.name.capitalize()
Task mergeAssetsTask = tasks.findByName("merge${suffix}Assets")
Task processAssetFileTask = tasks.create(name: "process${suffix}AssetFile", type: Exec)
processAssetFileTask.commandLine "path/to/your/encryption/tool",
"--input-file=${inputFilePath}",
"--output-file=${outputFilePath}"
mergeAssetsTask.dependsOn processAssetFileTask
}
I have a project with two flavors and decided to add a third. However with the third flavor I am experiencing some problems.
My res file is not defined as an Android resource file, and consequently my layout xml files are not rendered.
You can see the file res file for flavor len does not have the yellow mark on the bottom right like the one for en.
When I right click on the en-res folder I see the create resource file, however I do not see this for my len-res folder.
Is there a way I can tell studio my folder is a resource folder ?
I am running 0.3.7 on Windows
productFlavors {
de {
packageName 'org.rh.ellierides.de'
}
en {
packageName 'org.rh.ellierides'
}
len {
packageName 'org.rh.ellierides.en.lite'
}
I resolved this by changing the build variant to the specific one which was causing me problems in my case len
Once I built this flavor the project self corrected.
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.