java lang NoClassDefFoundError on activity start in android 4.4

Refresh

April 2019

Views

15 time

0

My application is giving me java lang noclassdeffounderror when i start a new activity. Its working fine with higher version of android api but when i use android api 19 or android kitkat 4.4 its not working. i have checked many answers but none of them is working

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.bls.msparescustomerapp"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 8
        versionName "2.9"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        renderscriptTargetApi 19
        renderscriptSupportModeEnabled true
    }
    buildTypes {
        release {
            multiDexKeepFile file('multidex-config.txt')
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    implementation 'com.romandanylyk:pageindicatorview:0.0.7'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.google.guava:guava:24.1-jre'
    implementation 'com.android.volley:volley:1.1.1'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'org.greenrobot:eventbus:3.1.1'
    implementation 'com.android.support:multidex:1.0.3'
    implementation "com.daimajia.swipelayout:library:[email protected]"
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
    implementation 'com.airbnb.android:lottie:2.7.0'
    implementation 'com.google.guava:guava:27.1-jre'
    implementation 'com.cepheuen.elegant-number-button:lib:1.0.2'
    implementation 'com.kofigyan.stateprogressbar:stateprogressbar:1.0.0'
    implementation 'com.irozon.sneaker:sneaker:2.0.0'
    implementation 'com.southernbox:ParallaxRecyclerView:1.0.1'
    implementation 'com.iarcuschin:simpleratingbar:0.1.5'
    implementation 'com.getbase:floatingactionbutton:1.10.1'
    implementation 'com.jackandphantom.android:blurimage:1.2.0'
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.google.firebase:firebase-database:16.1.0'
    implementation 'com.google.firebase:firebase-auth:16.2.1'
    implementation 'net.alhazmy13.MediaPicker:libary:2.4.4'
    implementation 'com.squareup.retrofit2:retrofit:2.5.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'

    //Paging items
    implementation "android.arch.lifecycle:extensions:1.1.0"
    implementation "android.arch.lifecycle:viewmodel:1.1.0"

Here is the manifest. All my activities are declared in manifest as answered in many questions. But this error isnt solving for me.

<application
        android:name=".MyApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_app_logo"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_app_logo_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:usesCleartextTraffic="true"
        tools:ignore="GoogleAppIndexingWarning"
        tools:replace="android:icon">
        <activity android:name=".activities.AllProductsActivity"></activity>
        <activity android:name=".activities.BrandItemsActivity" />
        <activity android:name=".activities.HomeBottomNavActivity" />
        <activity android:name=".activities.CatalogItems" />
        <activity android:name=".activities.Catalog" />
        <activity android:name=".activities.BrandCompoItems" />
        <activity android:name=".activities.ItemDetailsActivity" />
        <activity android:name=".activities.SearchItems" />
        <activity android:name=".activities.CheckOut" />
        <activity android:name=".activities.SignUp" />
        <activity
            android:name=".activities.HomeActivity"
            android:label="@string/title_activity_home"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme.NoActionBar" />
        <activity android:name=".activities.LoginActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".activities.ChatActivity" />

Following is the stack trace.

W/System.err: java.lang.NoClassDefFoundError: com.bls.msparescustomerapp.activities.AllProductsActivity
        at com.bls.msparescustomerapp.fragments.HomeFragment.createView(HomeFragment.java:171)
        at com.bls.msparescustomerapp.adapters.newHomeAdapters.HomeItemsRecyclerAdapter$HomeProductsLoadMoreViewHolder$1.onClick(HomeItemsRecyclerAdapter.java:143)
        at android.view.View.performClick(View.java:4438)
        at android.view.View$PerformClick.run(View.java:18422)
        at android.os.Handler.handleCallback(Handler.java:733)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5017)
        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:779)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
        at dalvik.system.NativeStart.main(Native Method)

0 answers