Android Question Adaptive icons not working

MrKim

Well-Known Member
Licensed User
Followed the instruction HERE.

But getting the following errors:

B4X:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.superlativesoftware.nag/com.superlativesoftware.nag.main}: android.content.res.Resources$NotFoundException: Drawable com.superlativesoftware.nag:mipmap/ic_launcher with resource ID #0x7f030002
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7356)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: android.content.res.Resources$NotFoundException: Drawable com.superlativesoftware.nag: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:876)
    at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:659)
    at android.content.res.Resources.getDrawableForDensity(Resources.java:906)
    at android.content.res.Resources.getDrawable(Resources.java:845)
    at android.content.Context.getDrawable(Context.java:687)
    at com.android.internal.widget.ToolbarWidgetWrapper.setIcon(ToolbarWidgetWrapper.java:322)
    at com.android.internal.widget.ActionBarOverlayLayout.setIcon(ActionBarOverlayLayout.java:754)
    at com.android.internal.policy.PhoneWindow.setDefaultIcon(PhoneWindow.java:1776)
    at android.app.Activity.initWindowDecorActionBar(Activity.java:3310)
    at android.app.Activity.setContentView(Activity.java:3345)
    at com.superlativesoftware.nag.main.onCreate(main.java:61)
    at android.app.Activity.performCreate(Activity.java:7802)
    at android.app.Activity.performCreate(Activity.java:7791)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7356)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
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:1249)
    at android.content.res.ResourcesImpl.loadXmlDrawable(ResourcesImpl.java:937)
    at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:862)
    ... 25 more
Caused by: java.io.FileNotFoundException: Corrupt XML binary file
    at android.content.res.AssetManager.nativeOpenXmlAsset(Native Method)
    at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:1041)
    at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1233)
    ... 27 more
Message longer than Log limit (4000). Message was truncated.
Here is my manifest:
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.basic4ppc.com/forum/showthread.php?p=78136
'<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="4"/>
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
    SetActivityAttribute(StopNagging2, android:theme, @android:style/Theme.Translucent.NoTitleBar)
    'SetActivityAttribute(StopNagging2, android:theme, @android:style/Theme)
'SetApplicationAttribute(android:icon, "@drawable/icon")   'remmed 11/16/19
 '11/16/19  added next two lines
SetApplicationAttribute(android:icon, "@mipmap/ic_launcher")
CreateResource(mipmap-anydpi-v26, ic_launcher.xml,
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@mipmap/background"/>
    <foreground android:drawable="@mipmap/foreground"/>
</adaptive-icon>
)
SetApplicationAttribute(android:label, "$LABEL$")
AddPermission(android.permission.RECEIVE_SMS)
AddPermission(android.permission.PROCESS_OUTGOING_CALLS)
AddPermission(android.permission.READ_EXTERNAL_STORAGE)  '6/4/18 - required for 26
AddPermission(android.permission.ACCESS_NOTIFICATION_POLICY)  '6/4/18 - required for 26
AddReceiverText(DoSMSNotification, <intent-filter>    <action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>)
AddReceiverText(DoSMSNotification, <intent-filter>    <action android:name="android.provider.Telephony.MMS_RECEIVED" />
</intent-filter>)
AddPermission(android.permission.READ_PHONE_STATE)
AddReceiverText(DoNotification, <intent-filter>    <action android:name="android.intent.action.PHONE_STATE" />
</intent-filter>)
'AddReceiverText(DoNotification, <intent-filter>    <action android:name="android.intent.action.SERVICE_STATE" />
'</intent-filter>)
AddReceiverText(DoNotification, <intent-filter>    <action android:name="android.provider.Telephony.LISTEN_MESSAGE_WAITING_INDICATOR" />
</intent-filter>)
AddReceiverText(UserPresent, <intent-filter>    <action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>)
AddReceiverText(UserPresent, <intent-filter>    <action android:name="android.intent.action.NEW_OUTGOING_CALL" />
</intent-filter>)
'End of default text.
CreateResourceFromFile(Macro, Themes.LightTheme)
AddApplicationText(<uses-library android:name="org.apache.http.legacy" android:required="false" />)  'Added10/24/19 to fix error with LicenseChecker
'CreateResourceFromFile(Macro, Themes.DarkTheme)
I triple checked everything:p. What am I missing this time?
 
Top