FirebaseMessagingService非法访问

时间:2019-06-23 18:39:56

标签: android firebase flutter firebase-cloud-messaging

我正在使用Flutter构建应用程序。最近,我在其中添加了Firebase分析,但现在遇到了一个致命问题。我不确定是什么原因造成的。

我已经搜索过了,但是没有答案帮助了我。任何指针将不胜感激。

如果您需要更多有关的信息,请告诉我。

日志:

java.lang.IllegalAccessError: Class com.google.firebase.iid.zzb extended by class com.google.firebase.messaging.FirebaseMessagingService is inaccessible (declaration of 'com.google.firebase.messaging.FirebaseMessagingService' appears in /data/app/com.rajesh.llda-ga6-btng3lZ5_NOlvI1ugQ==/base.apk:classes2.dex)
FATAL EXCEPTION: main
Process: com.rajesh.llda, PID: 17994
java.lang.IllegalAccessError: Class com.google.firebase.iid.zzb extended by class com.google.firebase.messaging.FirebaseMessagingService is inaccessible (declaration of 'com.google.firebase.messaging.FirebaseMessagingService' appears in /data/app/com.rajesh.llda-ga6-btng3lZ5_NOlvI1ugQ==/base.apk:classes2.dex)
    at java.lang.VMClassLoader.findLoadedClass(Native Method)
    at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
....

App 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"
apply plugin: 'io.fabric'

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

android {

    compileSdkVersion 28

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        applicationId "xxx"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
//        ndk {
//            abiFilters 'armeabi-v7a'
//        }
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
    androidTestImplementation 'androidx.annotation:annotation:1.0.0-beta01'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
//    implementation 'com.google.firebase:firebase-core:10.2.1'
    implementation 'com.google.firebase:firebase-messaging:10.2.1'
    implementation 'com.facebook.android:facebook-login:[5,6)'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'


}
configurations {
    all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}

configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:27.1.0'
    }
}

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

构建Gradle:

buildscript {
    ext.kotlin_version = '1.2.71'
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }

    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.2.0'
        // Add fabric classpath
        classpath 'io.fabric.tools:gradle:1.29.0'

    }
}

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

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
        }
    }
}


subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "26.1.0"
            }
        }
    }
}

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'androidx.localbroadcastmanager'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "1.0.0"
            }
        }
    }
}


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

0 个答案:

没有答案