android - React 本机应用程序无法在 android 版本 11 上运行
问题描述
我在本机反应中创建了一个应用程序。在 Android 版本 11 上它不起作用。我试图登录,但它给出了一个错误,并且使用相同的 ID 和密码,它可以在 android 版本 10 或更低版本上运行。
buildToolsVersion = "29.0.0"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
supportLibVersion = "29.0.0"
我应该将targetsdkversion更新为30吗?
日志猫
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' }
也得到
E/Netd: getNetworkForDns: getNetId from enterpriseCtrl is netid 0
更新:最后该应用程序在 android 11 上运行
安卓/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"
解决方案
在 android\build.gradle 添加:
ext {
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
buildToolsVersion = "30.0.2"
ndkVersion = "20.1.5948944"
}
和
在 android\app\build.gradle 添加:
implementation("com.squareup.okhttp3:okhttp:4.9.1")
implementation("com.squareup.okhttp3:okhttp-urlconnection:4.9.1")
推荐阅读
- laravel - 模型 > whereHas > 多连接 > 跨数据库 | 不工作
- mysql - Bash script for reads from csv and use it in mysql query
- javascript - Internet Explorer 11 onclick triggered only if scripting is allowed in Internet Zone
- mysql - How to convert a sql query to laravel queryBuilder
- c# - Passing a value of more than one type to a method parameter?
- python - How to make the search function work when the file is inside a model which is inside of another model
- git - 如何将分支与部分重新设置并强制推送的 master 合并?
- google-cloud-platform - GCP - how to add alert on number of messages sent to a pubsub dead letter queue?
- python - Python将名称与缺失值结合起来
- sql-server - Is it possible to load two flat files with different columns, perform calculations on the data, and then upload one data set to the database?