React native application not working on android version 11

Viewed 4081

I have created an application in react native. On Android version 11 it's not working. I tried to login but it gave an error and with the same id and password it's working on android version 10 or below.

 buildToolsVersion = "29.0.0"
 minSdkVersion = 16
 compileSdkVersion = 29
 targetSdkVersion = 29
 supportLibVersion = "29.0.0"

should I have to update targetsdkversion to 30?.

logcat

2021-06-04 12:57:12.798 4375-10265/com.xxxI/ReactNativeJS: 'parameters :-', { id: 'LOGIN_ID',
      api: 
       { body: 
          { _parts: 
             [ [ 'command', 'login' ],
               [ 'username', 'xxxxxxxxxxxxxx.com ' ],
               [ 'password', 'xxxxxxx' ] ] } } }
2021-06-04 12:57:12.834 4375-4375/com.xxx D/InputMethodManager: HSIFW - flag : 0
2021-06-04 12:57:41.165 4375-10218/com.xxx I/com.xxx: NativeAlloc concurrent copying GC freed 541077(17MB) AllocSpace objects, 16(320KB) LOS objects, 49% free, 7125KB/13MB, paused 213us total 115.644ms
2021-06-04 12:57:41.214 4375-10220/com.xxx W/System: A resource failed to call release. 
2021-06-04 12:58:12.828 4375-10265/com.xxx I/ReactNativeJS: 'In catch...error :-', { [Error: timeout] line: 557, column: 376, sourceURL: 'index.android.bundle' }

also getting

 E/Netd: getNetworkForDns: getNetId from enterpriseCtrl is netid 0

Update: finally the app is working on android 11

android/build.gradle

      buildToolsVersion = "30.0.0"
      minSdkVersion = 16
      compileSdkVersion = 30
      targetSdkVersion = 30
      supportLibVersion = "30.0.0"

android/app/build.gradle

minifyEnabled true

androdi/app/src/debug/AndroidManifest.xml

tools:targetApi="30"
1 Answers

in android\build.gradle add:

ext {
    minSdkVersion = 21
    compileSdkVersion = 30
    targetSdkVersion = 30
    buildToolsVersion = "30.0.2"
    ndkVersion = "20.1.5948944"
}

and

in android\app\build.gradle add:

implementation("com.squareup.okhttp3:okhttp:4.9.1")
implementation("com.squareup.okhttp3:okhttp-urlconnection:4.9.1")
Related