пакет android .support.v4.content не существует, флаттер - PullRequest
1 голос
/ 11 февраля 2020

Я получил несколько ошибок здесь. Пожалуйста, дайте мне знать, что я делаю не так. Генерируются следующие ошибки:

  C:\Users\Lenovo\flutter_windows_v1.2.1-stable\flutter\.pub-cache\hosted\pub.dartlang.org\fluttertoast-2.2.11\android\src\main\java\io\github\ponnamkarthik\toast\fluttertoast\FluttertoastPlugin.java:14: error: package android.support.v4.content does not exist
    import android.support.v4.content.ContextCompat;
                                     ^
    C:\Users\Lenovo\flutter_windows_v1.2.1-stable\flutter\.pub-cache\hosted\pub.dartlang.org\fluttertoast-2.2.11\android\src\main\java\io\github\ponnamkarthik\toast\fluttertoast\FluttertoastPlugin.java:107: error: cannot find symbol
              Drawable shapeDrawable = ContextCompat.getDrawable(ctx, R.drawable.toast_bg);
                                       ^
      symbol:   variable ContextCompat
      location: class FluttertoastPlugin
    2 errors

FAILURE: сборка завершилась с исключением. * Что пошло не так: выполнение задачи не выполнено ': fluttertoast: compileDebugJavaWith Javac'.

Ошибка компиляции; подробности смотрите в сообщении об ошибке компилятора.
* Try: Запустите с параметром --stacktrace, чтобы получить трассировку стека. Запустите с параметром --info или --debug, чтобы получить больше вывода журнала. Запустите с --scan, чтобы получить полное представление.
* Получите дополнительную помощь по https://help.gradle.org
СБОЙ ПО СТРОИТЕЛЬСТВУ за 6 с

    The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
    [!] Flutter tried to create the file `android\settings_aar.gradle`, but failed.
    To manually update `settings.gradle`, follow these steps:
        1. Copy `settings.gradle` as `settings_aar.gradle`
        2. Remove the following code from `settings_aar.gradle`:
                def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
                def plugins = new Properties()
                def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
                if (pluginsFile.exists()) {
                    pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
                }
                plugins.each { name, path ->
                    def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
                    include ":$name"
                    project(":$name").projectDir = pluginDirectory
                }
    Please create the file and run this command again.

Вот Уровень моего приложения 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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

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

    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.android.support:support-v4:27.1.1"
    implementation 'com.google.firebase:firebase-core:17.2.2'
    implementation 'com.google.firebase:firebase-analytics:17.2.0'

}

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'
    }
}

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
}

Любая помощь высоко ценится.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...