Android Question [SOLVED] Program type already present: okio.AsyncTimeout$Watchdog

foakgul

Member
Licensed User
Longtime User
Hello,

I've been using B4A since early releases for various projects. I updated to B4A v12.0 to recompile an old project of mine so that it conforms to latest Google Android guidelines.

Project was compiling fine on a previous version of B4A (non 64bit), using targetsdk of 29 or below but it had problems targeting api30 or api31, giving me "problem parsing package error".

When I switched to 64 bit version, now I'm getting the following error:

Dex merge Error
Error: Program type already present: okio.AsyncTimeout$Watchdog
Compilation failed

I'm using the same additional library folder as before which didn't complain. Here's a snapshot of libraries folder which includes okio. If I remove any of the okio jar files, compiler complains about not finding them.

1670399358381.png


Any suggestions are welcome

Thanks
Ferit
 

foakgul

Member
Licensed User
Longtime User
Hi Jose,

Thanks. Followed the instructions. Now I'm getting the following error:

B4X:
Dex merge    Error
Error in C:\Users\foakg\AppData\Local\Android\b4a-12-sdk\tools\..\extras\b4a_local\unpacked-okhttp-3.5.0-63703786950000\dex_v1\okhttp-3.5.0.zip:classes.dex:
Type okhttp3.Address is defined multiple times: C:\Users\foakg\AppData\Local\Android\b4a-12-sdk\tools\..\extras\b4a_local\unpacked-okhttp-3.5.0-63703786950000\dex_v1\okhttp-3.5.0.zip:classes.dex, C:\Users\foakg\AppData\Local\Android\b4a-12-sdk\tools\..\extras\b4a_local\unpacked-okhttp-4.9.0-63804276756000\dex_v1\okhttp-4.9.0.zip:classes.dex
Compilation failed

I'm assuming it might be caused by the existence of

OkHttp.jar
okhttp-3.5.0.jar
okhttp-4.9.0.jar

or

okio-1.11.0.jar
okio-2.8.0.jar

in the libraries folder. This didn't cause any problems with earlier version of B4A. Is there a way to recompile the libs by removing the duplicate ones?

If it's related, I tried to find the ini file for setting dexoptimization to false but it seems like I don't have the following folder:

%AppData%\Anywhere Software\Basic4android
1670403322164.png

1670403339016.png


Thanks
 
Upvote 0

foakgul

Member
Licensed User
Longtime User
Hi Erel,

Here are the libraries used by the code:
1670435594252.png


When I first compiled, the dex optimizer worked, and when I remove any jar file (okhttp-3.5.0.jar or okhttp-4.9.0.jar) from the libraries folder, it complains, even though these are not being used per the library matrix above. Please see below:
1670435751979.png


Thanks
 
Upvote 0

foakgul

Member
Licensed User
Longtime User
Right on @DonManfred ! Thanks a lot!
1670441557248.png


Turns out this was the culprit, solved by removing the library from the project altogether since I will not be using its functionality going forward in this release.

Cheers
 
Upvote 0
Top