6

Yesterday my phone got updated to Android 9 and by that time my app started crashing. I reinstalled it from the Android Studio, but the problem is still the same. Below is the Manifest code to see if there is any problem. Thank you.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.johny.test">

    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.READ_CALL_LOG" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name = "android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_maps_key" />

    </application>

</manifest>
Prashant Patel
  • 1,087
  • 11
  • 18
Edward M
  • 83
  • 1
  • 9
  • 3
    Use Logcat to examine the Java stack trace associated with your crash: https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this – CommonsWare Dec 16 '18 at 12:46
  • 1
    Possible duplicate of [Unfortunately MyApp has stopped. How can I solve this?](https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this) – Matt Ke Dec 16 '18 at 12:48
  • @Edward M, Did you check the crash on **Logcat**. – ॐ Rakesh Kumar Dec 16 '18 at 12:50
  • @RakeshKumar,yes I saw it and I found some errors such us `E/AndroidRuntime: FATAL EXCEPTION: Thread-5` and `java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion;` – Edward M Dec 16 '18 at 13:02
  • 2
    I found the solution ,it needs to add `` into AndroidManifest.xml inside the tag.Thank you for your time' – Edward M Dec 16 '18 at 13:06
  • @EdwardM, Welcome buddy. :) – ॐ Rakesh Kumar Dec 16 '18 at 13:35

3 Answers3

8

use this line in your into AndroidManifest.xml inside the <application> tag

    <application>
       ....
     .... android:usesCleartextTraffic="true"

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

    </application>
Abhay Pratap
  • 1,886
  • 11
  • 15
1

I had the same issue, I solved adding this lines on manifest.xml:

<application
    android:name=.....
    android:networkSecurityConfig="@xml/network_security_config"
    ...
</application>

And also creating the network_security_config.xml file on the res/xml folder and then fill it with this code:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">DOMAIN WITHOUT HTTP://</domain>
    </domain-config>
</network-security-config>
Sebastian Corradi
  • 1,353
  • 2
  • 14
  • 25
0

Put this line inside the application tag in your manifest file

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

  • With Android 6.0, we removed support for the Apache HTTP client. Beginning with Android 9, that library is removed from the bootclasspath and is not available to apps by default. for more go to https://developer.android.com/about/versions/pie/android-9.0-changes-28 – Vibhu Vikram Singh Jun 12 '19 at 12:15
  • 1
    You can [edit] your answer to have that info in the right context. Thanks! – rene Jun 12 '19 at 12:30