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
Recyclerview - How to Smooth Scroll to Top of Item on a Certain Position
Get the Current Fragment Object
What Is the Role of Content_Main.Xml in Android Studio 1.4
System.Loadlibrary(...) Couldn't Find Native Library in My Case
Question Mark () in Xml Attributes for Android
Animating Markers on Google Maps V2
What Is the Fastest Way to Scrape HTML Webpage in Android
How to Get Text on an Actionbar Icon
Can an Android App Connect Directly to an Online MySQL Database
Use a Custom Contextual Action Bar for Webview Text Selection
Couldn't Locate Lint-Gradle-Api-26.1.2.Jar for Flutter Project
Android Activity Ondestroy() Is Not Always Called and If Called Only Part of the Code Is Executed
Fool-Proof Way to Handle Fragment on Orientation Change
How Do Detect Android Tablets in General. Useragent
How to Get Recent Tasks on Android "L"
Detect the Status of Two Sim Cards in a Dual-Sim Android Phone