Skip to content
[android] androidxにプロジェクト移行したら、OssLicensesMenuActivity でエラー
androidios-tips
java-tips-scala-tips
2019-08-18

調べたけどなかなかぴったり説明が出なかったので。

targetSdkVersion 27 を 28 にしてねwariningがよく出るようになってきたので 28にアップしたら、androidxにしなきゃダメみたいなメッセージが出てきたので、ライブラリの依存性をごりごり修正してたら、OSSライセンス一覧生成画面のところで以下のエラー

java.lang.IncompatibleClassChangeError: Class 'com.google.android.gms.oss.licenses.OssLicensesMenuActivity' does not implement interface 'androidx.lifecycle.LifecycleOwner' in call to 'androidx.lifecycle.Lifecycle androidx.lifecycle.LifecycleOwner.getLifecycle()' (declaration of 'androidx.lifecycle.LiveData' appears in ・・・
java.lang.IncompatibleClassChangeError: Class 'com.google.android.gms.oss.licenses.OssLicensesMenuActivity' does not implement interface 'androidx.lifecycle.LifecycleOwner' in call to 'androidx.lifecycle.Lifecycle androidx.lifecycle.LifecycleOwner.getLifecycle()' (declaration of 'androidx.lifecycle.LiveData' appears in ・・・

解決方法 以下をgradleに追加

implementation "androidx.appcompat:appcompat:1.1.0-rc01"
implementation "androidx.appcompat:appcompat:1.1.0-rc01"