2016-12-05 349 views
0

我使用的Java 8 Lambda表達式使用lambda和得到這個錯誤 我的代碼如下:在Java 8中機器人工作室

Predicate<Site> predicate = c-> c.id == filter.get(0); 

並收到以下錯誤:

12-05 10:57:44.745 25416-25416/khabarazma.com E/AndroidRuntime: FATAL EXCEPTION: main 
                   Process: khabarazma.com, PID: 25416 
                   java.lang.NoClassDefFoundError: chitva_Pages.-$Lambda$17 
                    at chitva_Pages.Search$LoadFilter.lambda$-chitva_Pages_Search$LoadFilter_lambda$20(Search.java:3787) 
                    at chitva_Pages.-$Lambda$8.$m$0(Unknown Source) 
                    at chitva_Pages.-$Lambda$8.onClick(Unknown Source) 
                    at android.view.View.performClick(View.java:4455) 
                    at android.view.View$PerformClick.run(View.java:18448) 
                    at android.os.Handler.handleCallback(Handler.java:733) 
                    at android.os.Handler.dispatchMessage(Handler.java:95) 
                    at android.os.Looper.loop(Looper.java:149) 
                    at android.app.ActivityThread.main(ActivityThread.java:5064) 
                    at java.lang.reflect.Method.invokeNative(Native Method) 
                    at java.lang.reflect.Method.invoke(Method.java:515) 
                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794) 
                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610) 
                    at dalvik.system.NativeStart.main(Native Method) 

任何人都可以幫我?

回答

2

是否設置爲需要的一切對this page描述?

您應該java8功能配置搖籃:

android { 
    ... 
    defaultConfig { 
    ... 
    jackOptions { 
     enabled true 
    } 
    } 
    compileOptions { 
    sourceCompatibility JavaVersion.VERSION_1_8 
    targetCompatibility JavaVersion.VERSION_1_8 
    } 
} 
+0

是的,我的gradle這個是這樣的... –

+0

檢查鏈接以及 – abbath