Execution failed for task ':ios-moe:moeMainDebugX86Dex2Oat'

When I debug my libdgx game on MOE for iOS deployment, an error occurred:

dex2oat I  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/dex2oat/dex2oat.cc:2220] /Users/majirefy/.moe/moe-sdk-1.2.3/tools/dex2oat --instruction-set=x86 --base=0x40000000 --compiler-backend=Quick --generate-debug-info --image=/Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex2oat/debug-x86/image.art --image-classes=/Users/majirefy/.moe/moe-sdk-1.2.3/tools/preloaded-classes --oat-file=/Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex2oat/debug-x86/application.oat --dex-file=/Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex:/Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-ios-retro-dex.jar:/Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar
dex2oat I  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/runtime/parsed_options.cc:449] setting boot class path to /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex:/Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-ios-retro-dex.jar:/Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar
dex2oat W  3747 205593 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:2033] Failed to resolve class Lcom/badlogic/gdx/jnigen/AntScriptGenerator;
dex2oat W  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:2033] Failed to resolve class Lcom/badlogic/gdx/jnigen/BuildConfig;
dex2oat W  3747 205593 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:2033] Failed to resolve class Lcom/badlogic/gdx/jnigen/BuildTarget$TargetOs;
dex2oat W  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:2033] Failed to resolve class Lcom/badlogic/gdx/jnigen/BuildTarget;
dex2oat W  3747 205593 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:2033] Failed to resolve class Lcom/badlogic/gdx/jnigen/NativeCodeGenerator;
dex2oat W  3747 205591 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:2033] Failed to resolve class Lcom/badlogic/gdx/jnigen/BuildTarget;
dex2oat W  3747 205591 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONObject from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205592 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONArray from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONObject$1 from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205593 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONException from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205591 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONTokener from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205591 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONArray from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205591 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONException from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205591 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONObject$1 from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205591 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONObject from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205591 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONTokener from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/dex/verification_results.cc:61] Method processed more than once: void android.icu.text.NumberFormat.<clinit>()
dex2oat W  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/dex/verification_results.cc:61] Method processed more than once: java.lang.String java.lang.AbstractStringBuilder.substring(int)
dex2oat W  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/dex/verification_results.cc:61] Method processed more than once: java.lang.String com.android.org.bouncycastle.util.Strings.toLowerCase(java.lang.String)
dex2oat W  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/dex/verification_results.cc:61] Method processed more than once: java.lang.String java.lang.IntegralToString.stringOf(char[])
dex2oat W  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONArray from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONException from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONObject$1 from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONObject from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONTokener from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat I  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/runtime/gc/heap.cc:2729] Explicit concurrent mark sweep GC freed 35969(6MB) AllocSpace objects, 0(0B) LOS objects, 33% free, 7MB/11MB, paused 32us total 7.334ms
dex2oat W  3747 205592 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONArray from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205592 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONException from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205592 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONObject$1 from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONObject from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
dex2oat W  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/driver/compiler_driver.cc:1860] Skipping class org.json.JSONTokener from /Users/majirefy/Developer/project_aeii/ios-moe/build/moe/main/dex/classes.jar previously found in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex
 3 Zip: EOCD not found, /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex is not zip
 3 Zip: EOCD not found, /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex is not zip
 3 Zip: EOCD not found, /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex is not zip
dex2oat F 3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/oat_writer.cc:649]Unexpected failure to resolve a method: java.util.Iterator org.json.JSONArray.iterator()
dex2oat F  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/oat_writer.cc:655] java.lang.NoSuchMethodError: No virtual method iterator()Ljava/util/Iterator; in class Lorg/json/JSONArray; or its super classes (declaration of 'org.json.JSONArray' appears in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex)
dex2oat F  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/compiler/oat_writer.cc:655] (Throwable with empty stack trace)
NATIVE BACKTRACE:
0   dex2oat                             0x000000000b7f73d7 _ZN3art7Runtime5AbortEv + 97
1   dex2oat                             0x000000000b81d205 _ZN3art10LogMessageD2Ev + 807
2   dex2oat                             0x000000000b6e3387 _ZN3art9OatWriter22InitImageMethodVisitor11VisitMethodEmRKNS_21ClassDataItemIteratorE + 1791
3   dex2oat                             0x000000000b6dec2c _ZN3art9OatWriter15VisitDexMethodsEPNS0_16DexMethodVisitorE + 406
4   dex2oat                             0x000000000b6de699 _ZN3art9OatWriter19InitOatCodeDexFilesEm + 187
5   dex2oat                             0x000000000b6dd554 _ZN3art9OatWriterC2ERKNSt3__16vectorIPKNS_7DexFileENS1_9allocatorIS5_EEEEjmiPKNS_14CompilerDriverEPNS_11ImageWriterEPNS_12TimingLoggerEPNS_7SafeMapINS1_12basic_stringIcNS1_11char_traitsIcEENS6_IcEEEESN_NS1_4lessISN_EENS_17TrackingAllocatorINS1_4pairIKSN_SN_EELNS_12AllocatorTagE7EEEEE + 644
6   dex2oat                             0x000000000b561507 _ZN3art7Dex2Oat13CreateOatFileEv + 427
7   dex2oat                             0x000000000b553885 main + 645
8   libdyld.dylib                       0x00007fffea34c255 start + 1
9   ???                                 0x0000000000000009 0x0 + 9

dex2oat F 3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/runtime/runtime.cc:464]Runtime aborting...
Aborting thread:
"main" prio=5 tid=1 Runnable (still starting up)
  | group="" sCount=0 dsCount=0 obj=0x0 self=0x7fd572802c00
  | sysTid=205551 nice=-1 cgrp=default sched=1/31 handle=0x7ffff31993c0
  | state=? schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100
  | stack=0x7fff53eb2000-0x7fff53eba000 stackSize=8MB
  | held mutexes= "abort lock" "mutator lock"(shared held)
  (no managed stack frames)
Pending exception java.lang.NoSuchMethodError: No virtual method iterator()Ljava/util/Iterator; in class Lorg/json/JSONArray; or its super classes (declaration of 'org.json.JSONArray' appears in /Users/majirefy/.moe/moe-sdk-1.2.3/sdk/moe-core.dex)
(Throwable with empty stack trace)Dumping all threads without appropriate locks held: thread list lock
All threads:
DALVIK THREADS (1):
"main" prio=5 tid=1 Runnable (still starting up)
  | group="" sCount=0 dsCount=0 obj=0x0 self=0x7fd572802c00
  | sysTid=205551 nice=-1 cgrp=default sched=1/31 handle=0x7ffff31993c0
  | state=? schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100
  | stack=0x7fff53eb2000-0x7fff53eba000 stackSize=8MB
  | held mutexes= "abort lock" "mutator lock"(shared held)
  (no managed stack frames)

dex2oat W  3747 205551 /Volumes/SSD/gh-moe-master-1.2.3/aosp/art/runtime/barrier.cc:96] Attempted to destroy barrier with non zero count -1

I searched for it, some say change build.gradle of MOE moudle of my game. I added proguardLevel 'all', but more errors occurred.

Then I followed some topics to change configuarations in proguard.append.cfg. I added something like:

-keep class org.json.** { *; }

Then my proguard.append.cfg looked like:

-keep class com.badlogic.** { *; }
-keep enum com.badlogic.** { *; }
-keep class org.json.** { *; }

Then I debug my MOE moudle, still have same error.

It seems no other solutions mentioned.
Any suggestions?

Thanks for advance!

Hi,

from the log it looks like you are still using MOE 1.2.3. First, please try to upgrade to MOE 1.2.5 or to MOE 1.3 beta1, and see if that fixes the issue.

Best Regards,
Gergely

Thanks for reply!

I tried, but still no help.

Dear Majirefy,

There is no iterator for org.json.JSONArray. MOE is using Android’s Json implementation: https://developer.android.com/reference/org/json/JSONArray.html

Please use length() and get(idx) methods for iterating.

Best Regards,
Kristóf

Another note: perhaps you are using an external Json library which is also in the org.json package, thus conflicting with Android’s. In this case I would recommend changing the package of your external Json library.