Building any android project fails (Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode)



 Yesterday I upgraded to Tokio 10.2.3 and I have been able to build and run an android project.

 Today the same project and any other android project I try (including newly created blank new projects) fail to compile.

This is what I see within the delphi IDE, in the "messages" view:

Checking project dependencies...
Compiling TestRest.dproj (Debug, Android)
[Exec Error] The command "PATH C:\Program Files (x86)\Java\jdk1.8.0_131\bin;C:\Users\Public\Documents\Embarcadero\InterBase\redist\InterBaseXE7\IDE_spoof;C:\oracle32\client\product\12.2.0\client32\bin;C:\Program Files (x86)\Embarcadero\Studio\19.0\bin;C:\Users\Public\Documents\Embarcadero\Studio\19.0\Bpl;C:\Program Files (x86)\Embarcadero\Studio\19.0\bin64;C:\Users\Public\Documents\Embarcadero\Studio\19.0\Bpl\Win64;C:\ProgramData\Oracle\Java\javapath;C:\oracle32\client\product\12.1.0\client32\bin;C:\oracle\product\12.1.0\client64\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\ssh;C:\Program Files (x86)\cvsnt;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\BerlinWork\RBuilder\bpl;C:\BerlinWork\RBuilder\bpl\Win64;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\dotnet\;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Git\cmd;C:\Users\carlo\AppData\Local\Microsoft\WindowsApps & "C:\Users\Public\Documents\Embarcadero\Studio\19.0\PlatformSDKs\android-sdk-windows\build-tools\22.0.1\dx.bat" --dex --output="C:\TokioWork\Smanettamenti\TestRest\Android\Debug\classes.dex" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\android-support-v4.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\cloud-messaging.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\fmx.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-analytics-v2.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-billing.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-licensing.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-ads-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-analytics-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-base-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-identity-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-maps-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-panorama-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-plus-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-wallet-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services.dex.jar" " exited with code 2.
Elapsed time: 00:00:02.5

And this the ouput I get if I try to execute the failing command (the string starting with "PATH C:\.." in a command prompt window:

Merged dex A (520 defs/562.4KiB) with dex B (3 defs/2.1KiB). Result is 523 defs/693.6KiB. Took 0.1s
Merged dex A (523 defs/693.6KiB) with dex B (109 defs/113.5KiB). Result is 632 defs/1039.9KiB. Took 0.0s
Merged dex A (632 defs/1039.9KiB) with dex B (87 defs/113.2KiB). Result is 719 defs/1571.4KiB. Took 0.0s
Result compacted from 2332.6KiB to 771.2KiB to save 1561.4KiB
Merged dex A (719 defs/1571.4KiB) with dex B (3 defs/5.2KiB). Result is 722 defs/771.2KiB. Took 0.1s
Merged dex A (722 defs/771.2KiB) with dex B (25 defs/37.8KiB). Result is 747 defs/987.1KiB. Took 0.0s
Merged dex A (747 defs/987.1KiB) with dex B (511 defs/420.5KiB). Result is 1258 defs/1763.0KiB. Took 0.0s
Result compacted from 3175.9KiB to 1849.3KiB to save 1326.6KiB
Merged dex A (1258 defs/1763.0KiB) with dex B (408 defs/689.8KiB). Result is 1666 defs/1849.3KiB. Took 0.2s
Merged dex A (1666 defs/1849.3KiB) with dex B (522 defs/516.1KiB). Result is 2188 defs/2809.4KiB. Took 0.1s
Result compacted from 3472.9KiB to 2341.3KiB to save 1131.6KiB
Merged dex A (2188 defs/2809.4KiB) with dex B (26 defs/20.6KiB). Result is 2214 defs/2341.3KiB. Took 0.2s
Merged dex A (2214 defs/2341.3KiB) with dex B (273 defs/234.6KiB). Result is 2487 defs/3064.4KiB. Took 0.1s
Result compacted from 3790.6KiB to 2571.7KiB to save 1218.9KiB
Merged dex A (2487 defs/3064.4KiB) with dex B (19 defs/10.9KiB). Result is 2506 defs/2571.7KiB. Took 0.2s
Merged dex A (2506 defs/2571.7KiB) with dex B (117 defs/133.7KiB). Result is 2623 defs/3218.7KiB. Took 0.1s
Result compacted from 4107.9KiB to 2802.3KiB to save 1305.6KiB
Merged dex A (2623 defs/3218.7KiB) with dex B (141 defs/121.2KiB). Result is 2764 defs/2802.3KiB. Took 0.2s

UNEXPECTED TOP-LEVEL EXCEPTION: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;


Does anybody have any idea about how to fix this problem? what did I do to cause it?

Thank you!

P.S:  Yesterday I did run the "android SDK manager" and updated the "android SDK tools" while the IDE was still open... this is the only other thing I did.





  • Accepted Answer

    Thursday, March 29 2018, 04:31 AM - #Permalink

    Which SDK version and NDK version did you install.

    It's recommanded to install SDK 24.3.3 and most importantly NDK r9c
    I was never able to compile with higher versions.
    Also, from the Android Manager, install Platform tools, SDK Tools, SDK Build-tools and SDK Platform


    The reply is currently minimized Show
  • Responses (0)
    • There are no replies here yet.
    Your Reply

    Please login to post a reply.........