[英]Change your app's target API level to at least 30 - React Native
我正在開發一個 React-Native 應用程序(我是初學者),我在將應用程序上傳到 playstore 時遇到了這個錯誤:“您的應用程序當前針對 API 級別 29,並且必須至少針對 ZDB974238714CA8DE4FZA 級別以確保它建立在針對安全性和性能優化的最新 API 之上。將應用程序的目標 API 級別更改為至少 30。
這就是我的 build.gradle 文件在更改版本之前的樣子:
我知道我必須更改 Targetsdk、compiledsdk 和 buildtools,如下圖所示。
但是一旦我這樣做了,我的應用程序就會崩潰而沒有任何錯誤,我確實檢查了 supportLibVersion 的最新庫,但最新版本仍然是 28.0.0
如果我將版本恢復到 29,則該應用程序可以正常工作。
誰能幫我找出導致此問題的原因? 非常感謝您的幫助
提前感謝您的回答!
您可以嘗試通過 Android Studio 創建支持 API 30 的設備嗎?
Android Studio > 虛擬設備管理器 > 創建設備 > Select 設備 > Select ZDB974238714CA8DE1434A7CE1D08
方法2:我的工作build.gradle:
common to all sub-projects/modules.
buildscript {
ext {
googlePlayServicesVersion = "+" // default: "+"
firebaseMessagingVersion = "+"
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
}
repositories {
google()
jcenter()
// ADD THIS
maven { url 'https://maven.google.com' }
// ADD THIS
maven { url "https://www.jitpack.io" }
}
dependencies {
classpath("com.android.tools.build:gradle:4.0.1")
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
project.ext {
set('react-native', [
versions: [
// Overriding Build/Android SDK Versions
android : [
minSdk : 16,
targetSdk : 30,
compileSdk: 30,
buildTools: "30.0.2"
],
// Overriding Library SDK Versions
firebase: [
// Override Firebase SDK Version
bom : "26.0.0"
],
],
])
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.