question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Recompile and app crash immediately

See original GitHub issue

Information

  1. Apktool Version (apktool -version) -2.4.0
  2. Operating System (Mac, Linux, Windows) -Windows10
  3. APK From? (Playstore, ROM, Other) -Other

Stacktrace/Logcat

04-07 20:51:05.519 1558-1580/system_process W/WindowManager: Token{1c96074 ActivityRecord{8493047 u0 cn.pipizhu.live/com.fan.fan.activity.InitActivity t46}} failed creating starting window
    android.content.res.Resources$NotFoundException: File r/e/rw.png from drawable resource ID #0x7f070482
        at android.content.res.Resources.loadDrawableForCookie(Resources.java:2690)
        at android.content.res.Resources.loadDrawable(Resources.java:2580)
        at com.miui.internal.variable.v21.Android_Content_Res_Resources_class.handleLoadDrawable(SourceFile:29)
        at android.content.res.MiuiResources.loadDrawable(MiuiResources.java:388)
        at android.content.res.Resources.getDrawable(Resources.java:824)
        at android.content.Context.getDrawable(Context.java:467)
        at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:3934)
        at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:3981)
        at com.miui.internal.variable.v16.Internal_Policy_Impl_PhoneWindow_class.handleInstallDecor(SourceFile:217)
        at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:1969)
        at com.android.server.policy.PhoneWindowManager.addStartingWindow(PhoneWindowManager.java:2398)
        at com.android.server.wm.WindowManagerService$H.handleMessage(WindowManagerService.java:8106)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:157)
        at android.os.HandlerThread.run(HandlerThread.java:61)
        at com.android.server.ServiceThread.run(ServiceThread.java:46)
     Caused by: java.io.FileNotFoundException: r/e/rw.png
        at android.content.res.AssetManager.openNonAssetNative(Native Method)
        at android.content.res.AssetManager.openNonAsset(AssetManager.java:409)
        at android.content.res.Resources.loadDrawableForCookie(Resources.java:2679)
        at android.content.res.Resources.loadDrawable(Resources.java:2580) 
        at com.miui.internal.variable.v21.Android_Content_Res_Resources_class.handleLoadDrawable(SourceFile:29) 
        at android.content.res.MiuiResources.loadDrawable(MiuiResources.java:388) 
        at android.content.res.Resources.getDrawable(Resources.java:824) 
        at android.content.Context.getDrawable(Context.java:467) 
        at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:3934) 
        at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:3981) 
        at com.miui.internal.variable.v16.Internal_Policy_Impl_PhoneWindow_class.handleInstallDecor(SourceFile:217) 
        at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:1969) 
        at com.android.server.policy.PhoneWindowManager.addStartingWindow(PhoneWindowManager.java:2398) 
        at com.android.server.wm.WindowManagerService$H.handleMessage(WindowManagerService.java:8106) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:157) 
        at android.os.HandlerThread.run(HandlerThread.java:61) 
        at com.android.server.ServiceThread.run(ServiceThread.java:46) 

Steps to Reproduce

1、apktool d -f -r -c blaz.apk 2、apktool b blaz -f -r -c -o blaz\dist\blaz.apk 3、(Optional, if not got a keystone) keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000 4、Using WinRar to open new apk, and delete META-INF\FANFAN.RSA, META-INF\FANFAN.SF, META-INF\MANIFEST.MF, (So I can resign it) 5、jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore -storepass 123456 blaz\dist\blaz.apk alias_name 6、adb install blaz\dist\blaz.apk 7、App icon is missing, click app,crash immediately,logcat output posted above

Frameworks

If this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files Not from an OEM ROM

APK

http://www.mediafire.com/file/i511r1t8s6l5a2d/blaz.apk/file

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything? Exactly what I do,I did not change anything.
  2. If you are trying to install a modified apk, did you resign it? I do resign it
  3. Are you using the latest apktool version? 2.4.0, latest version for now I also try 2.3.1, no luck, same problem

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
grishkacommented, Jun 2, 2019

I think I’m on to something. While aapt didn’t output the mappings, I was able to extract them using jadx. So, I got this: drawables.xml.zip Then I made a quick-and-dirty php script I put it through:

<?php
$x=simplexml_load_file("drawables.xml");
$drawables=$x->drawable;
$map=[];
foreach($drawables as $d){
	$name=$d->attributes()->name;
	$file=$d->__toString();
	if(isset($map[$file])){
		echo "{$file} is used by {$map[$file]} and $name!\n";
	}else{
		$map[$file]=$name;
	}
}

And indeed, here’s its output:

r/2e.xml is used by action_button_blue_background and bg_promote_button_active!
r/ha.xml is used by action_button_background and bg_promote_button_inactive!
r/cm5.xml is used by action_bar_modal_button_background_whiteout and bg_simple_row!
r/ef.xml is used by bg_selectable_light_gray and bg_simple_row_grey0!
r/bio.xml is used by action_bar_blue_button_background and button_blue_background_no_rounding!
r/bf9.xml is used by direct_private_share_background and direct_reply_modal_background!
r/mn.xml is used by close_friends_add_button and friend_list_add_button!
r/cv0.xml is used by close_friends_remove_button and friend_list_remove_button!
r/cxr.xml is used by emoji_grey_bg and grey_circle_background!
r/bfs.xml is used by iglive_system_comment_button_background_rtl and iglive_system_comment_container_background_ltr!
r/54.xml is used by iglive_system_comment_button_background_ltr and iglive_system_comment_container_background_rtl!
r/cxq.xml is used by menu_vertical_divider and pending_inbox_permission_choices_divier!
r/cw2.xml is used by plain_white_button and plain_white_button_pressed!
r/c8v.xml is used by pulse_circle_inner and pulse_circle_outer!
r/crp.xml is used by generic_effect_picker_background_selected and question_sticker_format_picker_background_selected!
r/jk.xml is used by red_pill_profile_slideout_menu and red_pill_small!
r/b8c.xml is used by iglive_shadow_top and reel_viewer_shadow_top!
r/b0f.xml is used by red_circle_bg and sticky_notification_count_badge_background!
r/c6-.xml is used by instagram_heart_selector and tab_activity_drawable!
r/cvt.xml is used by instagram_user_selector and tab_profile_drawable!
r/lx.xml is used by instagram_search_selector and tab_search_drawable!
r/cl4.xml is used by tombstone_reason_background_video_feed and tombstone_reason_pressed_background_video_feed!
r/cwi.xml is used by reel_volume_indicator_background and volume_indicator_drawable!
r/c.xml is used by direct_large_avatar_button_background and white_circle_bg!

So, to work around this, you need to make several copies of such files when unpacking resources.

1reaction
iBotPeachescommented, Jun 2, 2019

@grishka You can use aapt. - aapt d resources name_of_apk.apk

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android App suddenly crashes when compiling in Release ...
My App was working fine when build to release mode, and both when downloading from Google play store or from a Android device...
Read more >
Sudden crash on launch from all TestFlight builds
When we publish the app in TestFlight, it crashes immediately with the same missing library. We were also getting an automated email after...
Read more >
Decompiling and Recompiling APK leads to crash using Apktool
Apktool says everything goes fine, but when the recompiled apk is installed it crashes instantly.
Read more >
App crashes instantly after successful build - Stack Overflow
App crashes instantly after successful build [duplicate] ... I tried a clean build and then rebuild also disable instant run but nothing new ......
Read more >
Apktool Decompile/Recompile App Crashes - XDA Forums
I am attempting to use apktool to decompile modify and recompile a app, but the app crashes as soon as it opens. I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found