Android Question Adaptive Icons - not working...

derez

Expert
Licensed User
Longtime User
The attached example is defined for adaptive icon like the tutorial - as much as I can think of:
The manifest is for 26 only, the changes done like in the tutorial.
Version of android is 27.
Files in the mipmap directory are read-only.
No icon is set in "project - choose icon".
B4a version - 7.30

The app is failing while looking for the icon's drawable.
Please check what I'm doing wrong...
Thanks.
 

Attachments

  • icons_test.zip
    15.7 KB · Views: 476
Last edited:

monic

Active Member
Licensed User
Longtime User
Simple mistake should rename forground.png to foreground.png in objects/res/mipmap/

Future point you should of posted the error message otherwise it takes longer to download, compile and spot the error.
 
Upvote 0

derez

Expert
Licensed User
Longtime User
Simple mistake should rename forground.png to foreground.png in objects/res/mipmap/

Future point you should of posted the error message otherwise it takes longer to download, compile and spot the error.
Thank you, I corrected the spelling but the problem is still there, like I wrote above - it looks for the ic_launcher:
Logger connected to: Google Pixel
--------- beginning of crash
--------- beginning of main
java.lang.RuntimeException: Unable to start activity ComponentInfo{derez.iconstest/derez.iconstest.main}: android.content.res.Resources$NotFoundException: Drawable derez.iconstest: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 derez.iconstest:mipmap/ic_launcher with resource ID #0x7f030002
Caused by: android.content.res.Resources$NotFoundException: File res/mipmap-anydpi-v26/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 derez.iconstest.main.onCreate(main.java:59)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
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-v26/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
D

Deleted member 103

Guest
@derez
your icon is not so central, but it works(b4a 8.30)
icontest.jpg
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Uploaded to the first post.
It does work for me without problem.

Based on the info you posted in the other thread (you are using Android.jar from api 26) i fear that you are using an OLD SDK Installation.

I want suggest to install a new SDK in a blank folder. And try it again with the newly installed SDK (dont forget to adapt the path to the android.jar from the new installation.

You can find the Setup-Instructions here. https://www.b4x.com/b4a.html
You also can watch this Video as it describes it clearly.

Start with a new Blank folder like you see in the Video.
 
Upvote 0

derez

Expert
Licensed User
Longtime User
Thank you DonManfred, you were right - I installed the sdk using the b4a sdk manager to a new directory, now it works !
Now I can play with icons and try to overcome Google's annoying design.
 
Upvote 0
Top