0

Android 9.0 not login but below 9.0 works fine
generally my code works fine on marshmallow when I build my app android pie it is not working. My code here below I can not understand this problem.

AndroidManifest.xml code

**<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="io.ionic.starter" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:networkSecurityConfig="@xml/network_security_config" android:supportsRtl="true" android:usesCleartextTraffic="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="org.apache.cordova.camera.FileProvider">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/camera_provider_paths" />
        </provider>
    </application>
    <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</manifest>**



     **Ionic Info : Ionic:**

            Ionic CLI                     : 5.2.8 (C:\Users\Dev\AppData\Roaming\npm\node_modules\ionic)
            Ionic Framework               : @ionic/angular 4.11.1
            @angular-devkit/build-angular : 0.801.3
            @angular-devkit/schematics    : 8.1.3
            @angular/cli                  : 8.1.3
           @ionic/angular-toolkit        : 2.0.0

         Cordova:

            Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
            Cordova Platforms : android 8.1.0
            Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.2, (and 12 other plugins)

         Utility:

            cordova-res : 0.6.0
            native-run  : 0.2.8

         System:

            Android SDK Tools : 26.1.1 (C:\Users\Dev\AppData\Local\Android\Sdk)
            NodeJS            : v10.13.0 (C:\Program Files\nodejs\node.exe)
            npm               : 6.11.3
            OS                : Windows 10

when login Android 9 show this problem only

  HttpErrorResponse {headers: HttpHeaders, status: 0, statusText: 
        "Unknown Error", url: "http://example.com//access-token", ok: false, …}
                error: ProgressEvent {isTrusted: true, lengthComputable: false, loaded: 0, total: 0, type: "error", …}
                headers: HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, headers: Map(0)}
                message: "Http failure response for http://example.com//access-token: 0 Unknown Error"
                name: "HttpErrorResponse"
                ok: false
                status: 0
                statusText: "Unknown Error"
                url: "http://example.com//access-token"
Kevin Jose
  • 856
  • 8
  • 22
babu
  • 1
  • 2

2 Answers2

0

Since you didn't post your code part, here are some possible solution.

  1. In most of the cases in ionic, Status code 0 usually indicates a CORS failure. Please check if CORS is enabled or not.

  2. Second most possible cause is SSL certification.

  3. Android platform level 28 disables cleartext network communications by default.

https://developer.android.com/training/articles/security-config.html#CleartextTrafficPermitted

https://stackoverflow.com/a/56178196/7803492

Dhruv Singh
  • 2,185
  • 2
  • 11
  • 17
0

Step 1.

Open AndroidManifest.xml from [yourProject]/platform/android/app/src/main/AndroidManifest.xml

Setp 2.

Add this line to that file

android:usesCleartextTraffic="true"

step3. Save the file and rebuild the apk again

Kevin Jose
  • 856
  • 8
  • 22