Android change package name - android

Is it possible tou change the project name of an apk outside android studio?
i need a tool if exists, to change the com.example.app into com.myapp.app but without any IDE, only with the signed apk file. Is it possible?

Try to type packageName com.my.name in build gradle.

Related

unable to create signed apk (keystore) android studio 1.4.1

I saw many tutorials in which the user is able to select the folder to create new keystore in....but in android studio 1.4.1.... I can only select *.jks files. Also I created a keystore using keytool (java) and then created the signed apk choosing existing keystore....I was able to create app-release.apk....but google is giving this error on upload
You uploaded an APK signed with a certificate that is not yet valid. You need to sign your APK with a certificate that is currently valid. Learn more about signing.
You need to use a different package name because "com.example" is restricted.
You cannot have certain names like com.example and com.google in your package name. Your package name has to be unique in play store.
Apart from that Android follows the same conventions for naming packages as Java does.
Generally to make it unique, the package is named like yourDomainNameInReverse.YourAppname
For example, the package name for Mozilla firefox android app is org.mozilla.firefox
if you are using android studio the change applicationId in build.gradle file.
your current app id id like applicationId "com.example.zyz" then change it to applicationId "com.testmyname.zyz"
no need to change/manage packages & code
Follow the steps
Select Project -> Click Build -> Click Generate Signed APK
then follow the process shown there..
For the first error:
You uploaded an APK signed with a certificate that is not yet valid. You need to sign your APK with a certificate that is currently valid.
Answer: I had to change my system date to two days back and then again generate the keystore. ....or you can simply wait till your certificate becomes valid.
For the second error:
You need to use a different package name because "com.example" is restricted.
Answer: In Android Studio go to the tree hierarchy and right click your package name folder under "app/java/your_package_name" and go to refractor and then rename. A pop up will appear....choose rename package and rename it to something else than default com.example.package_name. Also change it in AndroidManifest.xml file.

How to correctly rebuild my application after renaming package?

I've renamed my package name using Project -> Android Tools -> Rename Package. I've also cleaned my project and changed the config.xml widget ID to reflect the same name. When I try and run the simulator and/or my project in general, I get multiple Failed to load properties file for project. Is there anything I am missing changing my package name to correctly run my application? Thanks!
edit: I am receiving this error: The declared package "ca.treatfinder" does not match the expected package "com.treatfinder"
Just build it...In eclipse go to project->build and clean...when you want to rename sth you can use rightclick->refactor->rename...then theses issues won't come around

I have changed package name of the project but when i am creating apk it shows the package name different in android studio

I have changed package name from com.example to com.test of the project, but when I ran the project again, on the run console it shows adb shell am start -n "com.example" instead of adb shell am start -n"com.test".
Check manifest file and also the project gradle file. In my case gradle file was not updated (dont know why).
You will need to rename package name in AndroidManifest file, Android system takes package name from there.
it should lokk like below.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="**com.test**" // change this
go to android manifest and change name of your package
go to the project structure then click on your app folder then go on flavors and change your app id to correct

Setting up Android system app in eclipse

I've downloaded an Android system application source code.
When I import the project in eclipse and try to run it in the emulator it shows signature error. I think this happens because the package name in manifest is suppossed to be different than any applications already installed in the phone, but when I try to change the package name in manifest file the autogenerated R.java file gets deleted.
Now my questions are
how can I avoid this Signature mismatch error?
how can I modify package name in manifest file so that R.java file doesn't get deleted?
Or how can I simply android System application from eclipse?
Why not try to recreate the whole android app? I mean, since you donwloaded it, just create a new blank android app and create necessary classes, xmls, changest to manifest file and copy the codes you have and paste it with the new one. With this, you will be able to see one by one how the code works and debug it just the way you create it. Hope this somewhat helps.
To make system application, your application must have product signing key(signature) which matched to real device. That key is in \build\target\product\security\
Quoting from https://stackoverflow.com/a/9645224/1163019
"If you want a signatureOrSystem permission, you just need to be placed on the system image; you don't need to be signed with any special cert. You can do this as a one-off (until you exit the emulator) like this:"
> adb root
> adb remount
> adb push /path/to/My.apk /system/app/My.apk
You can update the package name in eclipse, using "Android Tools". Right click on project, choose "Rename Application Package" under "Android Tools". That should refactor the code as needed.
All right, I've figured that out.
It was giving signature error because the package name in manifest file i.e. com.android.inputmethods.latin matches with already installed android's default Android Keyboard. So I needed to change the package name in manifest file. I changed that, But then a new problem came forward, The R.java file got deleted automatically.
That happened because, as I changed package name I needed to update that in some XML files.
So logically until I did that there were some errors in XML files.
And the R.java file is generated automatically when there's no error in XML files.
So when I updated the XML files & fixed the error in there, R.java file generated automatically.
Hope this helps someone :)
adb push myApk.apk /system/app

Android: How to set the name of the compiled APK?

This question seems embarassingly simple, yet it vexes me still. I am using the standard ADT and Eclipse Android environment to build my Android app. The apk is named after the project name in Eclipse, but I want to name the apk something different...How can I customize the name of the apk artifact that is produced when the project builds?
android update project --name your_desired_name --path .
ant debug
You can also just edit the build.xml as following:
<project name="YourNewProjectNameHere" ...
if you are building with "ant" on the command line. Otherwise, Eclipse will always use your official ProjectName when create an apk. However, you can override that by right-clicking on project, and selecting Android Tools->Export Signed Application Package; which will then allow you to specify your own name for the package.
I am very surprised that there apparently is no way to do this, but alas I found that when finally exporting a signed apk file through eclipse you can specify the name of the APK. So that solves my problem.
Please Try This...
Please First Change \android-sdk\tools\ant\build.xml for signed release apk
These changes are onetime in build.xml because of this file every time use with your project build.xml to generate apk
<property name="out.final.file" location="${out.absolute.dir}/${ant.project.name}-release.apk" />
By
<property name="out.final.file" location="${out.absolute.dir}/${ant.project.name}.apk" />
Then execute command :
android update project --name your_desired_name --path .
ant release
Release APK Created in directory YourProjectName\bin by name :
your_desired_name.apk
If you just want to change the apk's name that appears on the smartphone's screen, you just need to go to click your project > res > values > string.xml then on app_name field inside the >< renamed the apk's name as you want.

Categories

Resources