Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.LinkageError: Method void GameHistoryViewModel.a() overrides final method in class Landroidx/lifecycle/ViewModel; appears in base.apk)

When i migrate to Androidx encountered this error only release build.I tried to update depenencies but doesnt work.Its working perfectly before androidx.I didnt understand.Thanks for help. When i migrate to Androidx encountered this error only release build.I tried to update depenencies but doesnt work.Its working perfectly before androidx.I didnt understand.Thanks for help.

Complete Error

java.lang.LinkageError: Method void com.kaznmx.app.kelime.features.gamehistory.GameHistoryViewModel.a() overrides final method in class Landroidx/lifecycle/ViewModel; (declaration of 'com.kaznmx.app.kelime.features.gamehistory.GameHistoryViewModel' appears in base.apk)
        at com.kaznmx.app.kelime.WordSearchApp.onCreate(:2)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1155)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5940)
        at android.app.ActivityThread.access$1100(ActivityThread.java:201)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1657)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6747)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:495)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

WordSearchApp Class

package com.kaznmx.app.kelime;

import android.app.Application;

import com.flurry.android.FlurryAgent;
import com.kaznmx.app.kelime.di.component.*;

import com.kaznmx.app.kelime.di.modules.AppModule;
import com.onesignal.OneSignal;

/**
 * Created by abdularis on 18/07/17.
 */

public class WordSearchApp extends Application {

    AppComponent mAppComponent;

    @Override
    public void onCreate() {
        super.onCreate();
        mAppComponent = DaggerAppComponent.builder().appModule(new AppModule(this)).build();
        OneSignal.startInit(this)
                .inFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
                .unsubscribeWhenNotificationsAreDisabled(true)
                .init();
        new FlurryAgent.Builder()
                .withLogEnabled(true)
                .build(this, "WJ634G9DD5HTFTHFKVFDZ");
    }

    public AppComponent getAppComponent() {
        return mAppComponent;
    }

}

BuildGradle(App)

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'


apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/'}
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.4, 0.99.99]'
    }
}

android {



    defaultConfig {
        manifestPlaceholders = [
                onesignal_app_id: '09f73c28-30df-4539-8e50-3da31c027731',
                // Project number pulled from dashboard, local value is ignored.
                onesignal_google_project_number: '712447187723'
        ]
    }

    signingConfigs {

        test {
            storePassword 'test1234'
            keyAlias = 'key0'
            keyPassword 'test1234'
            storeFile file('C:\\Users\\Onur\\test1234.jks')
        }
    }
    lintOptions {

        checkReleaseBuilds false

    }
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.parakazanin.cevirkazangorevyap"
        minSdkVersion 22
        targetSdkVersion 29
        versionCode 14
        versionName "3.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            shrinkResources true
            minifyEnabled true
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.test
        }
    }
    compileOptions {
        sourceCompatibility = '1.8'
        targetCompatibility = '1.8'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'com.android.volley:volley:1.1.1'
    implementation 'com.plattysoft.leonids:LeonidsLib:1.3.2'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.flurry.android:analytics:12.0.0@aar'
    implementation 'com.github.GrenderG:Toasty:1.4.1'
    testImplementation 'junit:junit:4.12'
    implementation 'com.onesignal:OneSignal:[3.11.2, 3.99.99]'

    implementation 'com.jakewharton:butterknife:10.2.0'

    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel:2.0.0'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.6'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
    implementation 'com.github.abdularis:CircularImageView:v1.2'

    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'com.google.android.gms:play-services-ads:18.2.0'
    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0'
    implementation "com.google.dagger:dagger:2.15"
    implementation "com.google.dagger:dagger-android:2.15"
    kapt "com.google.dagger:dagger-compiler:2.15"
    kapt "com.google.dagger:dagger-android-processor:2.15"

}



Mapping.txt

com.kaznmx.app.kelime.features.gamehistory.GameHistoryViewModel -> com.kaznmx.app.kelime.features.gamehistory.GameHistoryViewModel:
    com.kaznmx.app.kelime.data.GameDataSource mGameDataSource -> a
like image 694
Onur Aydeniz Avatar asked Nov 29 '22 21:11

Onur Aydeniz


1 Answers

I think it's because you have a method named clear(), which is a final method of higher version of ViewModel class. If that's the case, you can resolve this issue by changing your method's name.

like image 130
Liam Avatar answered Dec 04 '22 01:12

Liam