Read the Package Name of an Android APK

Read the package name of an Android APK

aapt dump badging <path-to-apk> | grep package:\ name

Get the Main Package Name of an .apk File

extract the apk file and rebuilt the manifest file, then by parsing the xml manifest file you can find the main activity package name.
refer this link for parsing, and refer this link for extracting apk file.

How to get package name of apk path?

The apk is just a zip container - so you could unzip the apk and extract the manifest and parse the packagename from it. There might be a more convenient way to do this - but I am not aware of it

How to Identify the package name for specified application(.apk) in android

This will loop through installed applications and get package name and path to apk.
Assuming you have the ApplicationInfo for your apk, you can do the same approach as here (without loop).

PackageManager pm = getPackageManager();
for(ApplicationInfo app : pm.getInstalledApplications(0)) {
Log.d("PackageList", "package: " + app.packageName + ", sourceDir: " + app.sourceDir);
}

Having trouble getting a package name from Apk

public static void getApkPackage(PackageManager pm, String pathToApk) {
String fullPath = pathToApk;
PackageInfo info = pm.getPackageArchiveInfo(fullPath, 0);
Log.i("Package", "PackageName: " + info.packageName + ", VersionName : " + info.versionName );

}

Result :

PackageName: me.pou.app, VersionName : 1.4.73
PackageName: com.elevenbitstudios.twommobile, VersionName : 1.4.3

Ok guys i found the answer. We dont need to run exec to get details of 'not installed' apk. Just use PackageManager.getPackageArchiveInfo with path so we will get apk details.

extract package name from apk file

hoe you are looking for this try this code :

String line;
while ((line = r.readLine()) != null) {
int ind = line.indexOf("package: name=");
if (ind >= 0) {
String yourValue = line.substring(ind + "default =".length(), line.length() - 1).trim(); // -1 to remove de ";"
System.out.println(yourValue);
}

WhatsApp changed the name of the package? Sudden error with package name

There are new changes in android 11 of package visibility. You need to add a new section under you app's tag: Please go through official documentation Link

Try this in manifest.xml

     <queries>

<package android:name="com.whatsapp" />
<package android:name="com.whatsapp.w4b" />

</queries>

OR this only.

<queries>
<package android:name="com.whatsapp" />
</queries>


Related Topics



Leave a reply



Submit