Android Question B4A 10.7, WhatsApp Stickers lib and DirAssets problem

asales

Expert
Licensed User
Longtime User
Until now I couldn't update to B4A 10.7, due some issues (incompatibility with DesignSupport and MaterialDateTimePicker libs, for example).

I fixed some of them , but now I got another issue:
I tried to compile the WhatsApp Sticker Example from DonManfred (Thanks Don!), but I get this error:
B4X:
** Activity (main) Create, isFirst = true **
content://de.donmanfred.sticker42.stickercontentprovider/metadata
[com.sticker4w.StickerPack@df102d1]
loader.fetchStickerPacks
main_activity_create (java line: 369)
java.lang.IllegalStateException: Asset file doesn't exist. pack: Cuppy, sticker: 01_Cuppy_smile.webp
    at com.sticker4w.StickerPackLoader.getStickersForPack(StickerPackLoader.java:82)
    at com.sticker4w.StickerPackLoader.fetchStickerPacks(StickerPackLoader.java:63)
    at de.donmanfred.StickerPackLoaderwrapper.fetchStickerPacks(StickerPackLoaderwrapper.java:37)
    at de.donmanfred.sticker42.main._activity_create(main.java:369)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
    at de.donmanfred.sticker42.main.afterFirstLayout(main.java:105)
    at de.donmanfred.sticker42.main.access$000(main.java:17)
    at de.donmanfred.sticker42.main$WaitForLayout.run(main.java:83)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6123)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
Caused by: java.io.IOException: cannot read sticker asset:1/01_Cuppy_smile.webp
    at com.sticker4w.StickerPackLoader.fetchStickerAsset(StickerPackLoader.java:137)
    at com.sticker4w.StickerPackLoader.getStickersForPack(StickerPackLoader.java:76)
    ... 15 more
First I thought the cause was the images is in the subfolder "1" in DirAssets (I saw some questions about 10.7 and subfolders).
I tried to move the all the images files from the subfolder "1" to the DirAssets folder, but I still get the same error.
The lib works only with images in the DirAssets folder.

I have some apps that uses this lib with several subfolders with images in DirAssets folder.

If I compile with the B4A 10.2 works fine.

There are a workaround for this issue?

Thanks in advance for any tip.
 
Last edited:

asales

Expert
Licensed User
Longtime User
Assets files are lowercased automatically. Libraries should lowercase the given file. Looks like it doesn't happen here.

Use "01_cuppy_smile.webp"
Even changing the names to lowercase (in the DirAssets files and in the contents.json file that is used by the lib) don't works:
B4X:
java.lang.IllegalStateException: Asset file doesn't exist. pack: cuppy, sticker: 01_cuppy_smile.webp
The weird is that works fine in B4A 10.2.
 
Upvote 0

asales

Expert
Licensed User
Longtime User
Are you testing in release mode?
Yes. Release, release (obfuscated) and real device.

I checked again and I think the problem is the lib uses the subfolders in DirAssets to separate the stickers packages.
There is no visible option to change the folder separator "/ or \".

Any workaround to make the B4A 10.7 compatible with the subfolders in DirAssets like the B4A 10.2?
 
Upvote 0

Ferdari

Active Member
Licensed User
Longtime User
Yes. Release, release (obfuscated) and real device.

I checked again and I think the problem is the lib uses the subfolders in DirAssets to separate the stickers packages.
There is no visible option to change the folder separator "/ or \".

Any workaround to make the B4A 10.7 compatible with the subfolders in DirAssets like the B4A 10.2?
Hi @asales , Use StickerCommander library, it don't need to use DirAssets.

I also has to update most of my apps because of the new 10.7, fixed most errors by packing needed files(in subfolders) in a zip and unzipping on app first open to DirCache, DirInternal, etc.
 
Upvote 0

asales

Expert
Licensed User
Longtime User
Hi @asales , Use StickerCommander library, it don't need to use DirAssets.

I also has to update most of my apps because of the new 10.7, fixed most errors by packing needed files(in subfolders) in a zip and unzipping on app first open to DirCache, DirInternal, etc.
Thanks, @Ferdari !
I use your (great) lib in new projects, but I have some apps thats uses the old lib, work fine and I didn't intend to change them.
But I think that I will need to do this, if I plan to migrate to B4A 10.7.
 
Upvote 0
Top