Set Process ID of apk - android

I have a req. like I have Application A created by me and APK of Application B.
Is it possible for me to set the process id and user id both same for the apk as well as application A. I don't have manifest of application B since its an apk. Is it possible for me to run the apk and an application of my own in the same process? Please help.

You need to set a sharedUserId in both manifest.xml files.
The process id (normal install) must not be the same on each device. You get the id from the device.

If you have access to the manifest.xml of the apk, you can set the sharedUserId.
EDIT:
If you Have only the apk file. You can use the android-apktool, this tool allows you to "decode resources to nearly original form and rebuild them after making some modifications". So you can have access to the AndroidManifest.xml and there change the sharedUserId.

Related

What is the difference between changing package name vs applicationId

What is the difference between changing package name vs applicationId to the final apk.
I know it is different for aspect of keeping source code, but lets say I got some app with package name a.b.c.d.
What will be the difference in the builded apk file
if I rename the a.b.c.d into q.w.e.r and then build the apk file
vs
change the applicationId into gradle with q.w.e.r
The package name is just to organize your code.
The applicationId, on the other hand, is used to identify your app in the Play Store. You will change this only if you plan to generate another app based on same code.
From docs (https://developer.android.com/studio/build/application-id.html):
When you create a new project in Android Studio, the applicationId
exactly matches the Java-style package name you chose during setup.
However, the application ID and package name are independent of each
other beyond this point. You can change your code's package name (your
code namespace) and it will not affect the application ID, and vice
versa (though, again, you should not change your application ID once
you publish your app). However, changing the package name has other
consequences you should be aware of, so see the section about
modifying the package name.
Some Android API like google map and firebase ask for your package name when you create the key. That package name they refer to is actually your applicationId. Yup Google insist on using the term package name for these API key. Don't get it confuse.
Taken from doc (https://developer.android.com/studio/build/configure-app-module#set_the_application_id):
"Note: The application ID used to be directly tied to your code's package name; so some Android APIs use the term "package name" in their method names and parameter names, but this is actually your application ID. For example, the Context.getPackageName() method returns your application ID. There's no need to ever share your code's true package name outside your app code."
Application id mostly used for:
Change the application ID for testing
Change the application ID for build variants
In this case, each build variant should be defined as a separate
product flavor. For each flavor inside the productFlavors {} block,
you can redefine the applicationId property, or you can instead append
a segment to the default application ID using applicationIdSuffix, as
shown here:
Every Android app has a unique application ID that looks like a Java
package name, such as com.example.myapp. This ID uniquely identifies
your app on the device and in Google Play Store. If you want to upload
a new version of your app, the application ID (and the certificate you
sign it with) must be the same as the original APK—if you change the
application ID, Google Play Store treats the APK as a completely
different app. So once you publish your app, you should never change
the application ID.
And package name is:
Although your project's package name matches the application ID by
default, you can change it. However, if you want to change your
package name, be aware that the package name (as defined by your
project directory structure) should always match the package attribute
in the AndroidManifest.xml file, as shown here:
The Android build tools use the package attribute for two things:
1- It applies this name as the namespace for your app's generated R.java
class.
Example: With the above manifest, the R class will be
com.example.myapp.R.
2- It uses it to resolve any relative class names
that are declared in the manifest file.
Example: With the above
manifest, an activity declared as is resolved to be
com.example.myapp.MainActivity.
Know more from Source
Once you upload the app on Play store you can't change the application id for that project , if you want to do then google play store consider as a different application.
In case of package name you can change it as you want.

creating new app by modifying another app

I want to create a new app by modifying code of an existing app's source code. So I did the following from eclipse:
exported the code of the old app "app1" to a file system.
created a new Java project "app2", and imported the code that was exported earlier.
modified strings.xml, and renamed the app_name as "app2"
made other edits to app2's code, for a new feature.
ran app2 on the mobile device (connected to the PC)
Now app2 is working correctly, and its name is also seen as "app2". But I see that when I loaded the code onto the mobile device, it has replaced the app1 that was previously installed, ie the app1 is no more visible on the device.
So my question is: what other changes do I need to make (apart from the strings.xml:app_name) to make a completely new app? ie, I want both app1 and app2 to exist on the device.
You have to change package name as package name plays as unique in android.
Here is showing way how to do that :
https://stackoverflow.com/a/4025422/4161269

Issues with application signature

I'm trying to create my own version of Gesture Builder. In eclipse I selected android project from existing code and I renamed the project and package name to new gesture. Then I added in android:fadeOffset = "1000" in create gesture xml(so that I can create gestures for letters like t and f) and in AndroidManifest.xml I set the version name to NewGestures and I set a different icon but when I try to run it I get this error message:
"Re-installation failed due to different application signatures. You must perform a full uninstall of the application. WARNING: This will remove the application data! Do you want to uninstall?"
From what I've seen online I need to match the signature used originally on Gesture Builder, but I've no idea how to do this on eclipse, shouldn't the signature have been handled properly when I created from existing code? Any help would be very much appreciated. I just need this app working so I can get a gestures library for a different application I'm working on for college.
This message concerns the application signature. This happens when you are trying to install an application on your device while an application of the same package name is already installed, but signed with a different certificate (see details here).
For example:
You have exported and installed your application using your Google Play keystore (so using your actual developer's certificate), and now you are running/debugging it from Eclipse, implicitely using the debug certificate (which is different)
You have runned/debugged your application from Eclipse at home on this device, and now your are running it/debugging it from Eclipse with another computer (which is using a different implicit debug certificate)
etc
Normally, below the error message, you have a button that allows uninstalling/reinstalling. If not, just uninstall your app manually and everything will be fine again.
versionName:
The version number shown to users. This attribute can be set as a raw
string or as a reference to a string resource. The string has no other
purpose than to be displayed to users.
package:
The package name serves as a unique identifier for the application.
The package name declared in your manifest.xml is what makes your application unique. Therefore, there can not be two application installed with the same package name at the same time. If you try this, your error occurs.

Is there a way to change the name of an application on Google Play app store?

I submitted an app to the app store last year and I found out a few weeks ago the name is being used for something similar. Is there a way to change the name of the app?
UPDATE:
In AIR you an application has an application descriptor file. In the application descriptor file is the Android manifest.
In the application descriptor file change the name attribute (leave the id the same):
<application xmlns="http://ns.adobe.com/air/application/3.6">
<id>com.mycompany.myAppID</id>
<filename>MyApplicationFile</filename>
<name>My Application Name</name>
At first I thought that you needed to change the "android:label" attribute on the application tag in the Android specific section as shown:
<android>
<manifestAdditions><![CDATA[
<manifest android:installLocation="auto">
<uses-sdk android:targetSdkVersion="12"/>
<uses-sdk android:minSdkVersion="8"/>
<application android:label="My Application Name"></application>
</manifest>
]]></manifestAdditions>
</android>
But when I did that I would get an error, "error 404: Android attribute android:label is not allowed to be overridden". I'm guessing the AIR compiler is setting that attribute through the name property.
In Android on the device the name has been changed. However, I have yet to upload this to GooglePlay. I think I need to change the application product name there as well.
UPDATE
Answer: Change the name property.
<application xmlns="http://ns.adobe.com/air/application/3.6">
<id>com.mycompany.myAppID</id>
<filename>MyApplicationFile</filename>
<name>Application Name Can Change</name>
You cannot change the ID as mentioned in an answer but you can change the name. I changed the name, created a new build, uploaded it to the Google app store and it has changed on the Google app store successfully.
Yes, you can change the name whenever you want by changing android:label attribute of your application tag in AndroidManifest.xml file.
But, you can't change Package name once you uploaded app on play store.
It turns out that all I had to do to change the name of the app is to change the name property in the application descriptor file.
Before:
<application xmlns="http://ns.adobe.com/air/application/3.6">
<id>com.mycompany.myAppID</id>
<filename>MyApplicationFile</filename>
<name>My Application Name</name>
</application>
After:
<application xmlns="http://ns.adobe.com/air/application/3.6">
<id>com.mycompany.myAppID</id>
<filename>MyApplicationFile</filename>
<name>My Shiny New Application Name</name>
</application>
I changed the name, created a new build and package, uploaded it to Google app store and published. I changed the name of the Google app store listing a few minutes after upload. When the app changes went live the app name was changed. The app may have been in draft mode but I think I published it on accident before changing the name in the store. Either way it's updated.
The app ID shows up in some locations and lists and there is nothing you can do AFAIK to change it after it has been submitted to some app stores except submit a new app with that ID.
Take a look at this link if you want to change your app name. Also you have to update your app on Google Play.
yes you can change, this is the answer i got from google support
me : can i change app name, app icon and description, after app is published
i mean the name appear on google play and icon
11:09 pm
Google play chat answer :
Yes, you can change your app details on the Main Store Listing page of your Play Console.
I can't comment yet so this is my answer.
You can't change the name of the package once you've uploaded the first APK.
You also can't remove an app from the store as far as I can see. You can only deactivate an APK and un-publish the store listing. As far as I can tell, you can't remove it to allow you to upload a package of the same name again o_0 - bit of a problem for me considering I misspelled my package name first time round :/
You don't need to re-upload your package. All apps -> select app -> store presence -> store listing and change the title

Changing the package name of an upgraded Android application

During the upgrade of my android application, I changed the package name. But Android market doesn't allow to upload the changed package name application as an upgrade. If I upload the application as a new application, will the user have two applications on his/her device? How can I make sure that the user doesn't have to download the application again from scratch without reverting the change of my package name?
two package = two different application in market place.
Once you upload one app, its package should be same. Also, the key should be same.
Android market is only concerned about the package name in your manifest, not the actual packages name in the source.
You could try to give the old package name in the manifest attribute, then for activities give the new package name instead of relative (ie .MainActivity)
Like this:
<manifest package="your.old.package" ...>
...
<application android:name="your.new.package.MainActivity" ...>
Could work..
I plan to serve two versions of my app (paid/free) this way and using same project and code.
If you change the package name, it's treated as a separate app - not just in the market, but apk's in general will only 'replace' the same package name (and only if they're both signed with the same key).
Although it's possible to phase over to a new key by signing an intermediate package with both keys, there's currently no easy way to phase over the package name.
The best that can be done is this:
New apk version is signed with the same key, but has a different package name.
When installed, the new apk arranges to use the shared_prefs with the old package name.
The data is copied across to the new package name.
The new version requests that the old version is removed, and the user sees the uninstall dialog.
Note app data is usually kept here:
/data/data/pac.kage.name/
I haven't tried this, so I can't give anymore details yet. You may also be interested in my request for a seamless way of transitioning the package name.

Categories

Resources