импорт трепетать - PullRequest
       9

импорт трепетать

3 голосов
/ 11 марта 2019

Итак, я хотел использовать firebase_auth во флаттере, но у меня возникла ошибка androidX.annotation.NonNull Я сделал несколько изменений в файлах Android и после большого количества беспорядочных бормотаний исправил ошибку, но теперь получаю

Ошибка

C:\Users\Dell\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.6.2+1\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java:8: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
C:\Users\Dell\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.6.2+1\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java:538: error: cannot find symbol
    public void onComplete(@NonNull Task<AuthResult> task) {
                            ^
  symbol:   class NonNull
  location: class FirebaseAuthPlugin.SignInCompleteListener
C:\Users\Dell\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.6.2+1\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java:558: error: cannot find symbol
    public void onComplete(@NonNull Task<Void> task) {
                            ^
  symbol:   class NonNull
  location: class FirebaseAuthPlugin.TaskVoidCompleteListener
C:\Users\Dell\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.6.2+1\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java:576: error: cannot find symbol
    public void onComplete(@NonNull Task<ProviderQueryResult> task) {
                            ^
  symbol:   class NonNull
  location: class FirebaseAuthPlugin.ProvidersCompleteListener
C:\Users\Dell\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.6.2+1\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java:175: error: cannot find symbol
                      public void onComplete(@NonNull Task<AuthResult> task) {
                                              ^
  symbol: class NonNull
C:\Users\Dell\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.6.2+1\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java:270: error: cannot find symbol
          public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                                          ^
  symbol: class NonNull
C:\Users\Dell\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.6.2+1\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java:435: error: cannot find symbol
              public void onComplete(@NonNull Task<GetTokenResult> task) {
                                      ^
  symbol: class NonNull
C:\Users\Dell\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.6.2+1\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java:487: error: cannot find symbol
          public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                                          ^
  symbol: class NonNull
Note: C:\Users\Dell\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_auth-0.6.2+1\android\src\main\java\io\flutter\plugins\firebaseauth\FirebaseAuthPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
8 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':firebase_auth:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 7s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                         8.5s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See  .... for more information on the problem and how to fix it.
*******************************************************************************************
Gradle task assembleDebug failed with exit code 1

android / gradle.properties

org.gradle.jvmargs=-Xmx1536M
android.useAndroidX = true
android.enableJetifier = true

android / app / 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.example.proapp"
        minSdkVersion 16
        targetSdkVersion 28
        multiDexEnabled true
        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'

}


apply plugin: 'com.google.gms.google-services'

pubspec.yaml

    name: pro_app
    description: A new Flutter project.

    # The following defines the version and build number for your application.
    # A version number is three numbers separated by dots, like 1.2.43
    # followed by an optional build number separated by a +.
    # Both the version and the builder number may be overridden in flutter
    # build by specifying --build-name and --build-number, respectively.
    # Read more about versioning at semver.org.
    version: 1.0.0+1

    environment:
      sdk: ">=2.1.0 <3.0.0"

    dependencies:
      flutter:
        sdk: flutter


      # The following adds the Cupertino Icons font to your application.
      # Use with the CupertinoIcons class for iOS style icons.
      cupertino_icons: ^0.1.2
      sqflite:
      path_provider: any
      intl:
      flutter_svg:
      charts_flutter:
      # firebase
      cloud_firestore:  
      firebase_auth:
      # firebase_core:  

    dev_dependencies:
      flutter_test:
        sdk: flutter
.......

Примечание: я уже пытался изменить compileSdkVersion и targetSdkVersion на 27, но затем я получил приложение: processdebugresources error.

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