0

I am getting the below errors in the live mode, the app works fine in the debug mode. When I upload the app to the play store, after that the app starts crashing immediately after the splash screen.

java.lang.NoSuchMethodError: No virtual method a(Ljava/io/InputStream;)V in class Lorg/apache/http/entity/BasicHttpEntity; or its super classes (declaration of 'org.apache.http.entity.BasicHttpEntity' appears in /system/framework/org.apache.http.legacy.boot.jar)
    at com.android.volley.toolbox.HurlStack.a(SourceFile:4)
    at com.android.volley.toolbox.HurlStack.performRequest(SourceFile:18)
    at com.android.volley.toolbox.BasicNetwork.performRequest(SourceFile:5)
    at com.android.volley.NetworkDispatcher.run(SourceFile:8)

I have tried several other online solutions, but none helped, I have tried minified enabled false, as some solutions suggested that it should work, but didn't work, the app keeps crashing after installation from the play store.

Here is my app configuration:

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
    compileSdkVersion 28
    defaultConfig {
        applicationId ""
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 9
        versionName "1.0"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            debuggable true
//            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }

    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    dexOptions {
        javaMaxHeapSize "2048M"
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha04'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.1.0-alpha05'
    implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0-alpha01'
    implementation 'androidx.browser:browser:1.0.0'
    implementation 'androidx.exifinterface:exifinterface:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha4'
    implementation 'com.intuit.sdp:sdp-android:1.0.5'
    implementation 'com.facebook.android:facebook-android-sdk:4.29.0'
    implementation 'com.github.rtoshiro.fullscreenvideoview:fullscreenvideoview:1.1.2'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
    implementation 'com.squareup.okhttp3:okhttp:3.12.1'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.airbnb.android:lottie:2.8.0'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
  //  implementation 'net.gotev:uploadservice:2.1'
    implementation 'com.razorpay:checkout:1.5.5'
    implementation 'com.shuhart.stepview:stepview:1.4.0'
   /* implementation('com.github.ganfra:material-spinner:2.0.0') {
        exclude group: 'com.android.support', module: 'appcompat-v7'
    }*/
    implementation 'com.klinkerapps:android-chips:1.3.0@aar'
    implementation 'com.github.yalantis:ucrop:2.2.2'
    implementation 'com.yahoo.mobile.client.android.util.rangeseekbar:rangeseekbar-library:0.1.0'
    implementation 'com.beloo.widget:ChipsLayoutManager:0.3.7@aar'
    implementation 'com.google.firebase:firebase-auth:16.2.1'
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
    implementation 'com.google.firebase:firebase-messaging:17.6.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'com.google.android.gms:play-services-places:16.0.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.maps.android:android-maps-utils:0.5'
    implementation 'com.hlab.fabrevealmenu:fab-reveal-menu:1.0.3'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0-alpha'
    implementation 'com.inscripts:CometChat:7.33.0'
    implementation project(':CometChatUiSDK')
//    implementation 'com.android.volley:volley:1.1.1'

    implementation 'com.github.lecho:hellocharts-library:1.5.8@aar'

}

repositories {
    mavenCentral()
    maven { url "https://maven.google.com" }
    maven { url "https://jitpack.io" }

}


apply plugin: 'com.google.gms.google-services'
ashngt
  • 1
  • 4
  • Possible duplicate of [java.lang.NoSuchMethodError: No virtual method execute for HttpClientResponse](https://stackoverflow.com/questions/32051149/java-lang-nosuchmethoderror-no-virtual-method-execute-for-httpclientresponse) – Mohamed Saeed Aug 17 '19 at 18:41

1 Answers1

1

try adding this line to your build.gradle:

android {

 useLibrary 'org.apache.http.legacy'

alternatively , try this in your manifest :

uses-library android:name="org.apache.http.legacy" android:required="false" />

the reason for this is due to the fact that, from android 9, that library is removed from the bootclasspath and is not available to apps by default, so it has to be added.

see : https://developer.android.com/about/versions/pie/android-9.0-changes-28#apache-p

a_local_nobody
  • 7,947
  • 5
  • 29
  • 51
  • thanks its solved the problem, app is running now in the live mode. – ashngt Aug 17 '19 at 20:12
  • Hi, I am still getting crashes in the app, it was looking fixed in one of the app, but in the other app, its not working correctly. – ashngt Aug 20 '19 at 09:56
  • which versions of android are you using for both apps – a_local_nobody Aug 20 '19 at 09:57
  • I have tested on Android 9.0 and 6.0, it crashes on both only in live mode, while in debugging mode it doesn't crash, also I tried to debug in the release mode, still no crash, I am doing alpha testing for the same, and when I download from the play store it crashes with the same errors. – ashngt Aug 20 '19 at 10:46
  • and you are sure these crashes are related to `Lorg/apache/http/entity/BasicHttpEntity` – a_local_nobody Aug 20 '19 at 10:47
  • here is my Android menifest: https://docs.google.com/document/d/1NVq05cejvrFQslZF0qBs1nf6P0-VcDNnx59W1d8PZCI/edit?usp=sharing – ashngt Aug 20 '19 at 10:49
  • Yes, crash logs are same, these logs I get from the report after the app crashed. – ashngt Aug 20 '19 at 10:50
  • if we use https, then we don't need to support legacy http right? – ashngt Aug 20 '19 at 10:53
  • i've got no idea, pretty sure you do have to add it either way, but i've got no clue about that specifically – a_local_nobody Aug 20 '19 at 10:55