Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6579] Android: TiAssetHelper - App icon error when launching app

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionInvalid
Resolution Date2020-08-04T22:34:32.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterMichael Gangolf
AssigneeAbir Mukherjee
Created2020-08-04T13:03:27.000+0000
Updated2020-08-04T22:34:32.000+0000

Description

I'm testing my app with 9.1.0.v20200724110711 and I am using adaptive icons:
<application android:theme="@style/Theme.MyTheme" android:icon="@mipmap/appicon" android:hardwareAccelerated="true" android:allowBackup="true">
/app/platform/android/res/mipmap-anydpi-v26/appicon_round.xml / appicon.xml
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@color/appicon_background"/>
    <foreground android:drawable="@mipmap/appicon_foreground"/>
</adaptive-icon>
and an appcicon.png in the mipmap-mdpi - xxxhdpi folders. When I launch my app it shows this error:
[ERROR] TiAssetHelper: Error while opening asset "Resources/images/appicon.png":
[ERROR] TiAssetHelper: java.io.FileNotFoundException: Resources/images/appicon.png
[ERROR] TiAssetHelper:  at android.content.res.AssetManager.nativeOpenAsset(Native Method)
[ERROR] TiAssetHelper:  at android.content.res.AssetManager.open(AssetManager.java:824)
[ERROR] TiAssetHelper:  at android.content.res.AssetManager.open(AssetManager.java:801)
[ERROR] TiAssetHelper:  at org.appcelerator.kroll.util.KrollAssetHelper.openAsset(KrollAssetHelper.java:140)
[ERROR] TiAssetHelper:  at org.appcelerator.titanium.io.TiResourceFile.getInputStream(TiResourceFile.java:71)
[ERROR] TiAssetHelper:  at org.appcelerator.titanium.TiBlob.getInputStream(TiBlob.java:359)
[ERROR] TiAssetHelper:  at org.appcelerator.titanium.TiBlob.guessContentTypeFromStream(TiBlob.java:193)
[ERROR] TiAssetHelper:  at org.appcelerator.titanium.TiBlob.loadBitmapInfo(TiBlob.java:259)
[ERROR] TiAssetHelper:  at org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:122)
[ERROR] TiAssetHelper:  at org.appcelerator.titanium.TiBlob.blobFromFile(TiBlob.java:105)
[ERROR] TiAssetHelper:  at ti.modules.titanium.ui.ShortcutItemProxy.handleCreationDict(ShortcutItemProxy.java:94)
[ERROR] TiAssetHelper:  at org.appcelerator.kroll.KrollProxy.handleCreationArgs(KrollProxy.java:202)
[ERROR] TiAssetHelper:  at org.appcelerator.kroll.KrollProxy.setupProxy(KrollProxy.java:128)
[ERROR] TiAssetHelper:  at org.appcelerator.kroll.KrollProxy.createProxy(KrollProxy.java:137)
[ERROR] TiAssetHelper:  at org.appcelerator.kroll.runtime.v8.V8Function.nativeInvoke(Native Method)
[ERROR] TiAssetHelper:  at org.appcelerator.kroll.runtime.v8.V8Function.callSync(V8Function.java:55)
[ERROR] TiAssetHelper:  at org.appcelerator.kroll.runtime.v8.V8Function.call(V8Function.java:41)
[ERROR] TiAssetHelper:  at ti.modules.titanium.TitaniumModule$Timer.run(TitaniumModule.java:156)
[ERROR] TiAssetHelper:  at android.os.Handler.handleCallback(Handler.java:883)
[ERROR] TiAssetHelper:  at android.os.Handler.dispatchMessage(Handler.java:100)
[ERROR] TiAssetHelper:  at android.os.Looper.loop(Looper.java:214)
[ERROR] TiAssetHelper:  at android.app.ActivityThread.main(ActivityThread.java:7356)
[ERROR] TiAssetHelper:  at java.lang.reflect.Method.invoke(Native Method)
[ERROR] TiAssetHelper:  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
[ERROR] TiAssetHelper:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
but the icon is visible. No error with 9.0.2.GA! Device: Pixel 4 (Android 10)

Comments

  1. Joshua Quick 2020-08-04

    [~michael], from looking at the stacktrace, your app is attempting to create a shortcut using "appicon.png" and it's failing to find it. In your Titanium code, look for a call to the createShortcutItem() method. What's the "icon" property set to?
  2. Michael Gangolf 2020-08-04

    Oh, that's embarrassing :D
       	shortcut = Ti.UI.createShortcutItem({
       		id: 'id_checkin',
       		title: 'Checkin',
       		icon: "/images/appicon.png",
       		description: 'Quick checkin'
       	});
       	shortcut.show();
       
    I had that in my code and the icon is not in the /images/ folder! Can be closed :) Will need to look at the new Shortcut stuff before implementing it!
  3. Joshua Quick 2020-08-04

    Great! Happy to help. FYI: Our shortcut API will be undergoing one more change in 9.1.0 before release. We're introduce a new Ti.UI.Shortcut module which is cross-platform between Android and iOS. Here is a sneak-peek. https://github.com/appcelerator/titanium_mobile/pull/11857

JSON Source