Android Question How to setup adaptive-icon ?

Erel

B4X founder
Staff member
Licensed User
Longtime User

Attachments

  • AdaptiveIcon.zip
    11.5 KB · Views: 569
Last edited:
Upvote 0

Multiverse app

Active Member
Licensed User
I get:
B4X:
java.lang.RuntimeException: Unable to start activity ComponentInfo{b4a.example3/b4a.example3.main}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030002
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2984)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045)
    at android.app.ActivityThread.-wrap14(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6776)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030002
    at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:202)
    at android.content.res.Resources.getDrawable(Resources.java:1641)
    at android.content.Context.getDrawable(Context.java:525)
    at com.android.internal.widget.ToolbarWidgetWrapper.setIcon(ToolbarWidgetWrapper.java:352)
    at com.android.internal.widget.ActionBarOverlayLayout.setIcon(ActionBarOverlayLayout.java:737)
    at com.android.internal.policy.PhoneWindow.setDefaultIcon(PhoneWindow.java:1817)
    at android.app.Activity.initWindowDecorActionBar(Activity.java:2534)
    at android.app.Activity.setContentView(Activity.java:2569)
    at b4a.example3.main.onCreate(main.java:59)
    at android.app.Activity.performCreate(Activity.java:6955)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
    ... 9 more
 
Upvote 0

palmzac

Active Member
Licensed User
Longtime User
Hi Erel,

My device is Nexus 5x on Android 8.1. The example code is not work. Do you have any idea ?

B4X:
--------- beginning of main
--------- beginning of crash
java.lang.RuntimeException: Unable to start activity ComponentInfo{b4a.example3/b4a.example3.main}: android.content.res.Resources$NotFoundException: Drawable b4a.example3:mipmap/ic_launcher with resource ID #0x7f030002
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2831)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2906)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1605)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:172)
    at android.app.ActivityThread.main(ActivityThread.java:6637)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: android.content.res.Resources$NotFoundException: Drawable b4a.example3:mipmap/ic_launcher with resource ID #0x7f030002
Caused by: android.content.res.Resources$NotFoundException: File res/mipmap-anydpi-v21/ic_launcher.xml from drawable resource ID #0x7f030002
    at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:768)
    at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:600)
    at android.content.res.Resources.getDrawableForDensity(Resources.java:876)
    at android.content.res.Resources.getDrawable(Resources.java:818)
    at android.content.Context.getDrawable(Context.java:605)
    at com.android.internal.widget.ToolbarWidgetWrapper.setIcon(ToolbarWidgetWrapper.java:322)
    at com.android.internal.widget.ActionBarOverlayLayout.setIcon(ActionBarOverlayLayout.java:742)
    at com.android.internal.policy.PhoneWindow.setDefaultIcon(PhoneWindow.java:1755)
    at android.app.Activity.initWindowDecorActionBar(Activity.java:2640)
    at android.app.Activity.setContentView(Activity.java:2675)
    at b4a.example3.main.onCreate(main.java:59)
    at android.app.Activity.performCreate(Activity.java:6975)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2784)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2906)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1605)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:172)
    at android.app.ActivityThread.main(ActivityThread.java:6637)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: android.content.res.Resources$NotFoundException: File res/mipmap-anydpi-v21/ic_launcher.xml from xml type drawable resource ID #0x7f030002
    at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1080)
    at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:756)
    ... 22 more
Caused by: java.io.FileNotFoundException: Corrupt XML binary file
    at android.content.res.AssetManager.openXmlAssetNative(Native Method)
    at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:546)
    at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1065)
    ... 23 more

Are you running this on Android 8?
 
Upvote 0

palmzac

Active Member
Licensed User
Longtime User
Hi Erel,

I used B4A SDK manager to update ALL recommended component. BUT... same result =_=!

B4X:
Logger connected to:  LGE Nexus 5X
--------- beginning of main
--------- beginning of crash
java.lang.RuntimeException: Unable to start activity ComponentInfo{b4a.example/b4a.example.main}: android.content.res.Resources$NotFoundException: Drawable b4a.example:mipmap/ic_launcher with resource ID #0x7f030002
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.content.res.Resources$NotFoundException: Drawable b4a.example:mipmap/ic_launcher with resource ID #0x7f030002
Caused by: android.content.res.Resources$NotFoundException: File res/mipmap-anydpi-v21/ic_launcher.xml from drawable resource ID #0x7f030002
    at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:820)
    at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:630)
    at android.content.res.Resources.getDrawableForDensity(Resources.java:877)
    at android.content.res.Resources.getDrawable(Resources.java:819)
    at android.content.Context.getDrawable(Context.java:605)
    at com.android.internal.widget.ToolbarWidgetWrapper.setIcon(ToolbarWidgetWrapper.java:322)
    at com.android.internal.widget.ActionBarOverlayLayout.setIcon(ActionBarOverlayLayout.java:742)
    at com.android.internal.policy.PhoneWindow.setDefaultIcon(PhoneWindow.java:1756)
    at android.app.Activity.initWindowDecorActionBar(Activity.java:2655)
    at android.app.Activity.setContentView(Activity.java:2690)
    at b4a.example.main.onCreate(main.java:59)
    at android.app.Activity.performCreate(Activity.java:6999)
    at android.app.Activity.performCreate(Activity.java:6990)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.content.res.Resources$NotFoundException: File res/mipmap-anydpi-v21/ic_launcher.xml from xml type drawable resource ID #0x7f030002
    at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1163)
    at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:805)
    ... 23 more
Caused by: java.io.FileNotFoundException: Corrupt XML binary file
    at android.content.res.AssetManager.openXmlAssetNative(Native Method)
    at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:546)
    at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1148)
    ... 24 more
java.lang.RuntimeException: Unable to start activity ComponentInfo{b4a.example/b4a.example.main}: android.content.res.Resources$NotFoundException: Drawable b4a.example:mipmap/ic_launcher with resource ID #0x7f030002
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.content.res.Resources$NotFoundException: Drawable b4a.example:mipmap/ic_launcher with resource ID #0x7f030002
Caused by: android.content.res.Resources$NotFoundException: File res/mipmap/ic_launcher.xml from drawable resource ID #0x7f030002
    at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:820)
    at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:630)
    at android.content.res.Resources.getDrawableForDensity(Resources.java:877)
    at android.content.res.Resources.getDrawable(Resources.java:819)
    at android.content.Context.getDrawable(Context.java:605)
    at com.android.internal.widget.ToolbarWidgetWrapper.setIcon(ToolbarWidgetWrapper.java:322)
    at com.android.internal.widget.ActionBarOverlayLayout.setIcon(ActionBarOverlayLayout.java:742)
    at com.android.internal.policy.PhoneWindow.setDefaultIcon(PhoneWindow.java:1756)
    at android.app.Activity.initWindowDecorActionBar(Activity.java:2655)
    at android.app.Activity.setContentView(Activity.java:2690)
    at b4a.example.main.onCreate(main.java:59)
    at android.app.Activity.performCreate(Activity.java:6999)
    at android.app.Activity.performCreate(Activity.java:6990)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.content.res.Resources$NotFoundException: File res/mipmap/ic_launcher.xml from xml type drawable resource ID #0x7f030002
    at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1163)
    at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:805)
    ... 23 more
Caused by: java.io.FileNotFoundException: Corrupt XML binary file
    at android.content.res.AssetManager.openXmlAssetNative(Native Method)
    at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:546)
    at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1148)
    ... 24 more
java.lang.RuntimeException: Unable to start activity ComponentInfo{b4a.example/b4a.example.main}: android.content.res.Resources$NotFoundException: Drawable b4a.example:mipmap/ic_launcher with resource ID #0x7f030002
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.content.res.Resources$NotFoundException: Drawable b4a.example:mipmap/ic_launcher with resource ID #0x7f030002
Caused by: android.content.res.Resources$NotFoundException: File res/mipmap/ic_launcher.xml from drawable resource ID #0x7f030002
    at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:820)
    at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:630)
    at android.content.res.Resources.getDrawableForDensity(Resources.java:877)
    at android.content.res.Resources.getDrawable(Resources.java:819)
    at android.content.Context.getDrawable(Context.java:605)
    at com.android.internal.widget.ToolbarWidgetWrapper.setIcon(ToolbarWidgetWrapper.java:322)
    at com.android.internal.widget.ActionBarOverlayLayout.setIcon(ActionBarOverlayLayout.java:742)
    at com.android.internal.policy.PhoneWindow.setDefaultIcon(PhoneWindow.java:1756)
    at android.app.Activity.initWindowDecorActionBar(Activity.java:2655)
    at android.app.Activity.setContentView(Activity.java:2690)
    at b4a.example.main.onCreate(main.java:59)
    at android.app.Activity.performCreate(Activity.java:6999)
    at android.app.Activity.performCreate(Activity.java:6990)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.content.res.Resources$NotFoundException: File res/mipmap/ic_launcher.xml from xml type drawable resource ID #0x7f030002
    at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1163)
    at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:805)
    ... 23 more
Caused by: java.io.FileNotFoundException: Corrupt XML binary file
    at android.content.res.AssetManager.openXmlAssetNative(Native Method)
    at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:546)
    at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1148)
    ... 24 more
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Caused by: android.content.res.Resources$NotFoundException: Drawable b4a.example:mipmap/ic_launcher with resource ID #0x7f030002
Caused by: android.content.res.Resources$NotFoundException: File res/mipmap-anydpi-v21/ic_launcher.xml from drawable resource ID #0x7f030002

Looks like you are missing some resources....

Upload a example project which shoes the issue
 
Upvote 0

palmzac

Active Member
Licensed User
Longtime User
Hi Erel,

Thanks for your help !
I don't know why. Let me to find out. (=_=!)

I've tried the attached example and it does work here.


Make sure to set the IDE to use the new SDK.

It will not work if you are using older versions of Android SDK.
 
Upvote 0

JohnnyHamburg

Member
Licensed User
I get the same error on Nokia 6. Think I did everything:
- update SDK,
- created 'mipmap'-folder containing background, foreground image Size 108x108, write protected
- added Manifest
- added code

Erels Example does not work either
Did anyone find a solution to this error?
 
Upvote 0

JohnnyHamburg

Member
Licensed User
Are you using B4A Sdk Manager?

Yes. I downloaded latest sdk yesterday. I installed "recommended files" and later "Android 27 source" and "android 26 source". Are there further installation files to choose?

Strangely, after taking out the changes from manifest and code to get my app working again, I receive "permission denied" -error when reading files via fileprovider.

This is my whole log:

B4X:
Logger verbunden mit: PLEGAR1771405847
--------- beginning of crash
--------- beginning of system
--------- beginning of main
java.lang.RuntimeException: Unable to start activity ComponentInfo{b4a.example3/b4a.example3.main}: android.content.res.Resources$NotFoundException: Drawable b4a.example3:mipmap/ic_launcher with resource ID #0x7f030002
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6501)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.content.res.Resources$NotFoundException: Drawable b4a.example3:mipmap/ic_launcher with resource ID #0x7f030002
Caused by: android.content.res.Resources$NotFoundException: File res/mipmap-anydpi-v21/ic_launcher.xml from drawable resource ID #0x7f030002
    at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:820)
    at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:630)
    at android.content.res.Resources.getDrawableForDensity(Resources.java:877)
    at android.content.res.Resources.getDrawable(Resources.java:819)
    at android.content.Context.getDrawable(Context.java:605)
    at com.android.internal.widget.ToolbarWidgetWrapper.setIcon(ToolbarWidgetWrapper.java:322)
    at com.android.internal.widget.ActionBarOverlayLayout.setIcon(ActionBarOverlayLayout.java:742)
    at com.android.internal.policy.PhoneWindow.setDefaultIcon(PhoneWindow.java:1766)
    at android.app.Activity.initWindowDecorActionBar(Activity.java:2668)
    at android.app.Activity.setContentView(Activity.java:2703)
    at b4a.example3.main.onCreate(main.java:61)
    at android.app.Activity.performCreate(Activity.java:7026)
    at android.app.Activity.performCreate(Activity.java:7017)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6501)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.content.res.Resources$NotFoundException: File res/mipmap-anydpi-v21/ic_launcher.xml from xml type drawable resource ID #0x7f030002
    at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1163)
    at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:805)
    ... 23 more
Caused by: java.io.FileNotFoundException: Corrupt XML binary file
    at android.content.res.AssetManager.openXmlAssetNative(Native Method)
    at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:546)
    at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1148)
    ... 24 more
 
Upvote 0

JohnnyHamburg

Member
Licensed User
I did use the example without changes. There comes the error-log from.
Device is Nokia 6 Android 8.1.

Do I have to choose something by my own from SDK-manager or change "android.jar" in configure path? Something like this?
 
Upvote 0
Top