【问题标题】:How to fix "Android SDK Build Tools version (27.0.3) is ignored..."如何修复“Android SDK Build Tools 版本 (27.0.3) 被忽略...”
【发布时间】:2019-11-23 09:22:30
【问题描述】:

我正在制作一个关于颤振的应用程序。我连接了 map_view: ^0.0.14 在地图上画了一条路,但出现以下错误:

  • 运行 Gradle 时出错:ProcessException:进程“C:\Users\admin\AndroidStudioProjects\advertise\android\gradlew.bat” 异常退出:

配置项目:app registerResGeneratingTask 已弃用,使用 registerGeneratedResFolders(FileCollection) registerResGeneratingTask 已弃用,请使用 registerGeneratedResFolders(FileCollection) registerResGeneratingTask 已弃用,请使用 registerGeneratedResFolders(FileCollection)

配置项目 :map_view 警告:指定的 Android SDK 构建工具版本 (27.0.3) 被忽略,因为它低于最低要求 Android Gradle 插件 3.2.1 支持的版本 (28.0.3)。安卓 将使用 SDK 构建工具 28.0.3。要禁止显示此警告,请删除 build.gradle 文件中的“buildToolsVersion '27.0.3'”,作为每个 Android Gradle 插件版本现在有一个默认版本 构建工具。 ****************************************************** ******* 警告:此版本的 firebase_auth 将破坏您的 Android 版本 如果它或其依赖项与 AndroidX 不兼容。 请参阅 goo.gl/CP92wY 以获取有关该问题以及如何解决该问题的更多信息。 此警告会针对所有 Android 构建失败打印。错误的真正根本原因可能是无关的。 ****************************************************** *******

FAILURE:构建失败并出现异常。

  • 出了什么问题:Android Gradle 插件仅支持 Kotlin Gradle 插件版本 1.2.51 及更高版本。项目'map_view'正在使用 1.2.50 版。

  • 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。

  • 通过help.grade.org获得更多帮助

在 2 秒内构建失败命令: C:\Users\admin\AndroidStudioProjects\advertise\android\gradlew.bat 应用程序:属性

以错误结束:请检查您的 Gradle 项目设置 android/文件夹。

app/build.gradel:

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.advertise"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    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 {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.google.firebase:firebase-core:16.0.9'
}
apply plugin: 'com.google.gms.google-services'

build.gradle:

 buildscript {
        repositories {
            google()
            jcenter()
        }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.51'

    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.advertise">
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="advertise"
        android:icon="@mipmap/ic_launcher">
        <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="xxxxxxxxxxxxxxxxxxxxxx"/>
        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
        <meta-data android:name="com.google.android.geo.API_KEY"
            android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxx"/>
        <activity android:name="com.apptreesoftware.mapview.MapActivity" android:theme="@style/Theme.AppCompat.Light.DarkActionBar"/>
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- This keeps the window background of the activity showing
                 until Flutter renders its first frame. It can be removed if
                 there is no splash screen (such as the default splash screen
                 defined in @style/LaunchTheme). -->
            <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                android:value="true" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
        <activity android:name="com.facebook.FacebookActivity"
            android:configChanges=
                "keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/app_name" />
        <activity android:name="com.facebook.CustomTabActivity" android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="@string/fb_login_protocol_scheme" />
        </intent-filter>
        </activity>

    </application>
</manifest>

【问题讨论】:

    标签: android flutter android-gradle-plugin build.gradle


    【解决方案1】:

    从这里很难确定,但我可以建议你:

    增加最低SDK版本:

    minSdkVersion 16
    

    到:

    minSdkVersion 21
    

    IDE 通常会在build.gradle 中警告您的Kotlin 版本。尝试通过 IDE 推荐修复它。可能会说更新到'1.3.21' 等。

    玩转gradle 版本:

    classpath 'com.android.tools.build:gradle:3.2.1'
    

    试试:3.3.0、3.0.1、3.4.1

    【讨论】:

    • 感谢您的帮助。它适用于 gradle 版本:classpath 'com.android.tools.build:gradle:3.0.1'
    【解决方案2】:

    在 buildgradel:library 中将 buildToolsVersion:'27.0.3' 更改为 '28.0.3',并修复了我的警告

    【讨论】:

      猜你喜欢
      • 2020-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多