Home Features Docs Blog Support GitHub

Trouble compiling Lambda functions NoClassDefFoundError


#1

Hello, I am using Libgx in conjunction with MOE. I recently upgraded my project to Java 8, I subsequently added several lambda functions throughout our my code. It’s my understanding that retrolambda is built into the gradel moe plugin so I didnt think it would be a problem but when I attempt to build I keep getting a
java.lang.NoClassDefFoundError: ... $$Lambda$...

More specifically:

dex2oat F 39769 2049836 /Users/rolandvigh/public-repo/aosp/art/compiler/oat_writer.cc:649]Unexpected failure to resolve a method: void com.myproject.csvModel.PlayerDetailsSpreadSheet$$Lambda$2.<clinit>()
dex2oat F 39769 2049836 /Users/rolandvigh/public-repo/aosp/art/compiler/oat_writer.cc:655] java.lang.NoClassDefFoundError: com.myproject.csvModel.PlayerDetailsSpreadSheet$$Lambda$2
dex2oat F 39769 2049836 /Users/rolandvigh/public-repo/aosp/art/compiler/oat_writer.cc:655] (Throwable with empty stack trace)
NATIVE BACKTRACE:
0   dex2oat                             0x000000000d7e6659 _ZN3art7Runtime5AbortEv + 99
1   dex2oat                             0x000000000d80aa99 _ZN3art10LogMessageD2Ev + 649
2   dex2oat                             0x000000000d6ce0c7 _ZN3art9OatWriter22InitImageMethodVisitor11VisitMethodEmRKNS_21ClassDataItemIteratorE + 1677
3   dex2oat                             0x000000000d6c9567 _ZN3art9OatWriter15VisitDexMethodsEPNS0_16DexMethodVisitorE + 257
4   dex2oat                             0x000000000d6c8eb9 _ZN3art9OatWriter19InitOatCodeDexFilesEm + 179
5   dex2oat                             0x000000000d6c7e93 _ZN3art9OatWriterC2ERKNSt3__16vectorIPKNS_7DexFileENS1_9allocatorIS5_EEEEjmiPKNS_14CompilerDriverEPNS_11ImageWriterEPNS_12TimingLoggerEPNS_7SafeMapINS1_12basic_stringIcNS1_11char_traitsIcEENS6_IcEEEESN_NS1_4lessISN_EENS_17TrackingAllocatorINS1_4pairIKSN_SN_EELNS_12AllocatorTagE7EEEEE + 611
6   dex2oat                             0x000000000d54ea0e _ZN3art7Dex2Oat13CreateOatFileEv + 428
7   dex2oat                             0x000000000d5406a3 main + 611
8   libdyld.dylib                       0x00007fff7b055015 start + 1
9   ???                                 0x0000000000000009 0x0 + 9

dex2oat F 39769 2049836 /Users/rolandvigh/public-repo/aosp/art/runtime/runtime.cc:464]Runtime aborting...

Please point me in the right direction if this topic has already been discussed as I haven’t found anyone else with this same problem. I am probably missing a fundamental step due to the lack of discussion on this topic. I don’t really know if this is a problem with libgdx, progaurd or moe so here’s here are all facts that might be helpful:

My Gradle
gdxVersion = '1.9.6'
classpath 'org.multi-os-engine:moe-gradle:1.+'
compile "com.badlogicgames.gdx:gdx-backend-moe:1.9.6

(changing either of the gdxVersion or gdx-backend-moe to 1.9.9 has no effect)

My Appended Additions To The Progaurd Config File

-keep class org.json.** { *; }
-keep class com.badlogic.** { *; }
-keep enum com.badlogic.** { *; }
-keep class com.kotcrab.** { *; }
-keepnames class * implements java.io.Serializable
-keepclassmembers class * implements java.io.Serializable {
    static final long serialVersionUID;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    Object writeReplace();
    Object readResolve();
}
-keep class com.myproject.csvModel.* { *; }

-keep class java.util.function.** { *; }
-keep class java.lang.invoke.** { *; }
-dontwarn java.lang.invoke.*
-dontwarn **$$Lambda$*

My Code

public void refreshUserStatuses() {
		MentalRep.getExecutor().execute(() ->{
			
			try {
				synchronized (statusUpdaters) {
					statusUpdaters.forEach(runnable -> {

						runnable.run();

						Utils.quiteSleep(300);
					});
				}

			} catch (Exception e) {
				Log.log(e);
			}
		});
	}

#2

try -keep class com.myproject.csvModel.** { *; }