Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PackageManager.PackageManager.GetApkFileEntry fail on resolve debugged apk's #31

Open
burak1000 opened this issue May 21, 2016 · 2 comments
Labels

Comments

@burak1000
Copy link

I try many time for PackageManager.Exist("mypackage"). Exit method crash.
because it use PackageManager.GetApkFileEntry. but GetApkPath more stable and find my apk's path.

I think. PackageManager.Exist method edit like as following

public bool Exists ( String package ) {
try {
return GetApkPath ( package ) != null;
} catch ( FileNotFoundException) {
return false;
}
}

@camalot
Copy link
Owner

camalot commented May 21, 2016

What are you passing as the package value? Because the GetApkFileEntry calls GetApkPath

return FileEntry.Find ( this.Device, GetApkPath ( package ) );

The package is not the path to your apk, it is your package name. From that value, the system calls pm path <package_name> and gets where the package lives on the device.

Please explain the scenario that it fails so I can attempt to reproduce it.

@burak1000
Copy link
Author

burak1000 commented May 21, 2016

if i try like this:

string package_path = "";    
try 
{     
package_path = tmpdevice.PackageManager.GetApkPath("com.LedFire.Cathay"); 
}     
catch (Exception apk_not_found_exception) { }
if (package_path == "") 
{ 
Console.WriteLine("LedFire not loaded on this machine: " + tmpdevice.SerialNumber); continue; 
}

and works good.

after this code package_path set to "/data/app/com.LedFire.Cathay-25.apk"

but i try like this Exist() method always returned false.

Boolean LedFire_exist = tmpdevice.PackageManager.Exists("com.LedFire.Cathay");
if (!LedFire_exist)  Console.WriteLine("LedFire not loaded on this machine: " + tmpdevice.SerialNumber); continue; 

and not working.

my package name is "com.LedFire.Cathay" . but i think ,because of "-25 ".
LedFire is my app and under development and reinstall offen.

@camalot camalot added the bug label Jun 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants