Android

[안드로이드]Fatal Exception: java.lang.NoSuchMethodError: No static method metafactory(n class Ljava/lang/invoke/LambdaMetafactory….오류 해결 방법

안드로이드 12를 타겟팅하면 발생된 오류이다.

Fatal Exception: cr)
       at androidx.activity.ComponentActivity.<init>(ComponentActivity.java:138)
       at androidx.fragment.app.FragmentActivity.<init>(FragmentActivity.java:103)
       at androidx.appcompat.app.AppCompatActivity.<init>(AppCompatActivity.java:94)
       at ddolcat.daily.budget.BaseActivity.<init>(BaseActivity.java:30)
       at ddolcat.daily.budget.MainActivity.<init>(MainActivity.java:62)
       at java.lang.Class.newInstance(Class.java)
       at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
       at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
       at android.app.Instrumentation.newActivity(Instrumentation.java:1273)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3901)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4201)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2438)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8669)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

 

[오류 해결방법]

build.gradle 파일에 컴파일 옵션 추가

android {
    ...
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

 

[reference]

https://stackoverflow.com/questions/59448845/no-static-method-metafactory

 

 

Leave a Reply

error: Content is protected !!