我在我的顫振應用程式中使用了 google_maps_flutter,但是當我將顫振更新到 2.10.2 版本時,這已經破壞了版本。
The plugin google_maps_flutter requires a higher Android SDK version. │
│ Fix this issue by adding the following to the file │
│ C:\Users\howle\Documents\GitHub\TicketDistribution\android\app\build.gradle: │
│ android { │
│ defaultConfig { │
│ minSdkVersion 20 │
│ } │
│ } │
│ │
│ Note that your app won't be available to users running Android SDKs below 20. │
│ Alternatively, try to find a version of this plugin that supports these lower versions of the │
│ Android SDK.
我按照更改版本的步驟進行操作,但它似乎不起作用,所以我想知道是否有其他開發人員面臨這個問題或有解決方案?
我將把我的 build.gradle 和 localproperties 檔案放在下面。應用程式/build.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion flutter.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion 20
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs = 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.ticket_distribution_app"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
本地屬性
sdk.dir=C:\\Users\\howle\\AppData\\Local\\Android\\sdk
flutter.sdk=C:\\flutter
flutter.buildMode=debug
flutter.versionName=1.0.0
flutter.versionCode=1
flutter.minSdkVersion=20
flutter.targetSdkVersion=20
提前干杯開發人員。
uj5u.com熱心網友回復:
使用此代碼更新您的 android -> app -> build.gradle 檔案,android而不是buildTypes. compileSdkVersion 將是正在編譯應用程式的 android 版本。minSdkVersion適用于您的應用程式可以兼容的最低 android 版本。現在大多數情況下,軟體包需要 21 作為 minSdk,因此將其設定為 21,但使用 20 它現在也應該可以作業,因為您也缺少 multidex 并且其中包含一些用于運行應用程式的代碼。
android {
compileSdkVersion 30
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs = 'src/main/kotlin'
}
defaultConfig {
applicationId "com.example.ticket_distribution_app"
minSdkVersion 21
multiDexEnabled true
targetSdkVersion 30
versionCode 1
versionName "1.0.0"
}
注意:請確保您使用的是顫振 2.10.0-2.10.2 然后更改compileSdkVersion為 31
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/435808.html
上一篇:使用googleApi獲取位置
下一篇:在移動和網路上使用谷歌地圖
