cloud_firestore android:foregroundServiceType 未找到

时间:2021-01-17 16:36:19

标签: android flutter gradle

尝试在 Android 上运行我的 Flutter 应用程序时遇到以下问题。下面也是文件。有什么想法吗?我不得不与我一直在使用的其他 Firestore 软件包一起升级我的 cloud_firestore。下面列出了所有软件包。

Launching lib/main.dart on Pixel 3 XL in debug mode...
lib/main.dart:1

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDevDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     /Users/zee/Repos/bazaaroh/build/app/intermediates/packaged_manifests/devDebug/AndroidManifest.xml:115: AAPT: error: attribute android:foregroundServiceType not found.
2

* 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 8s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin cloud_firestore...
Exception: The plugin cloud_firestore could not be built due to the issue above.

build.gradle

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.1'
        classpath 'com.google.gms:google-services:4.3.4'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
        classpath 'com.google.firebase:perf-plugin:1.3.1' // Performance Monitoring plugin
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}
configurations.all {
    resolutionStrategy {
        "androidx.core:core:1.0.2"  //Update to "androidx.core:core:1.1.0"
    }
}

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

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

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')
def flutterVersionName = localProperties.getProperty('flutter.versionName')

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.firebase.firebase-perf'

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        minSdkVersion 28
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        /*64 Build issue*/
        ndk {
            // Set up a supported SO library framework
            abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'//, 'mips', 'mips64'
        }
        /*64 Build issue*/
        multiDexEnabled true
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']

            firebaseCrashlytics {
                nativeSymbolUploadEnabled true
            }
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    // Specifies the flavor dimensions.
    flavorDimensions "app"
    productFlavors {
        dev {
            dimension "app"
            applicationId "com.app.bazaaroh"
        }
        prod {
            dimension "app"
            applicationId "com.app.bazaaroh"
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
    implementation 'androidx.multidex:multidex:2.0.0'
    implementation 'com.android.support:multidex:1.0.1'

    // (Recommended) Add Analytics
    implementation 'com.google.firebase:firebase-perf:19.0.1'
    implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
    implementation 'com.google.firebase:firebase-analytics:18.0.1'
    implementation 'com.google.firebase:firebase-crashlytics-ndk:17.3.0'
}
apply plugin: 'com.google.gms.google-services'

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.app.bazaaroh">

    <uses-permission android:name="android.permission.INTERNET"/>
    <!-- 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. -->
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT"/>
    <application
        android:label="@string/app_name"
        android:icon="@mipmap/ic_launcher">
        <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" />
            <meta-data
                android:name="flutterEmbedding"
                android:value="2" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>

            <intent-filter>
                <action android:name="FLUTTER_NOTIFICATION_CLICK" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/ic_action_name" />
        
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_color"
            android:resource="@color/custom_cyan" />

        <meta-data android:name="com.google.android.geo.API_KEY" 
            android:value="@string/google_maps_api_key"/>

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

        <activity
            android:name="com.yalantis.ucrop.UCropActivity"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>

    </application>
</manifest>

pubspec.yaml

algolia: ^0.1.7
cupertino_icons: ^0.1.3
carousel_pro: ^1.0.0
carousel_slider: 2.1.0
cloud_firestore: ^0.16.0
device_info: 0.4.2+4
firebase_auth: ^0.20.0+1
firebase_core: ^0.7.0
firebase_messaging: 6.0.15
firebase_storage: ^7.0.0
flare_flutter: ^2.0.3
flutter_cache_manager: ^1.1.3
flutter_facebook_login: 3.0.0
flutter_image_compress: 0.7.0
font_awesome_flutter: 8.5.0
# geoflutterfire: ^2.1.0
google_maps_flutter: 0.5.21+15
google_sign_in: ^4.5.3
image_cropper: ^1.1.2
image_picker: 0.6.7+6
cached_network_image: ^2.0.0
intl: ^0.16.1
keyboard_visibility: ^0.5.6
liquid_pull_to_refresh: ^1.1.1
location: 3.2.1
modal_progress_hud: ^0.1.3
package_info: 0.4.0+18
photo_view: ^0.9.2
provider: ^4.0.1
pub_semver: 1.4.4
rxdart: ^0.23.1
shared_preferences: 0.5.7+3
sign_in_with_apple: 2.5.2
simple_moment: ^1.0.4
url_launcher: 5.4.1

0 个答案:

没有答案