tufanbarisyildirim / php-apk-parser

Read basic info about an application from .apk file.
http://tufanbarisyildirim.github.io/php-apk-parser/
Other
343 stars 119 forks source link

getResources return nil in new android version #90

Open agvale opened 4 years ago

agvale commented 4 years ago

when i user getResources returns nil , but i use the apk in examples it works well.

pilif commented 3 years ago

this happens since the 2.0.3 update:

$p = new \ApkParser\Parser('some-apk-file.apk');
$l = $p->getManifest()->getApplication()->getLabel();
var_dump($p->getResources($l));

in 2.0.2, this returns an array with one element containing the application name. In 2.0.3, this returns false.

pilif commented 3 years ago

according to git bisect, this was caused by 1282c68f8d48536243367bb380569d53b7ff0bc3. I'll make a PR to fix this

pilif commented 3 years ago

never mind - this was just a config change.

instantiate \ApkParser\Parser with ['manifest_only' => false] as its config argument to restore the previous behavior.

Maybe the release notes for 2.0.3 should be updated.

nhitt-1337 commented 2 years ago

Hi everyone, I'm also getting this error right now. Here is my code to get the label:

$labelResourceId = $apk->getManifest()->getApplication()->getLabel(); // result: 0x7f0f0065
$label = $apk->getResources($labelResourceId);

$label return false. =(( I have tried with a number of different apk files and have the same results as above. Please help me. Thanks

songliqun commented 2 years ago

我提交的那个拉取请求就是解决这个问题的,你可以试下

afzafri commented 2 years ago

never mind - this was just a config change.

instantiate \ApkParser\Parser with ['manifest_only' => false] as its config argument to restore the previous behavior.

Maybe the release notes for 2.0.3 should be updated.

This helped. Thank you for pointing this out. I created a PR https://github.com/tufanbarisyildirim/php-apk-parser/pull/99 just to add this config to the example codes