java.lang.IllegalAccessError: Method 'void android.support.v4.content

前端 未结 4 557
心在旅途
心在旅途 2020-12-03 05:11

I updated playservice in my sdk and I got this error. And I am not able to access GCM Token. Before update sdk my project work perfectly.

I waste my whole day in i

4条回答
  •  佛祖请我去吃肉
    2020-12-03 06:04

    Please check your declared dependencies. As discussed in the given documentation there are three different types of direct dependencies in the app/ module's build.gradle file.

    Sample dependencies are as follows:

    android {...}
    ...
    dependencies {
        // The 'compile' configuration tells Gradle to add the dependency to the
        // compilation classpath and include it in the final package.
    
        // Dependency on the "mylibrary" module from this project
        compile project(":mylibrary")
    
        // Remote binary dependency
        compile 'com.android.support:appcompat-v7:25.0.1'
    
        // Local binary dependency
        compile fileTree(dir: 'libs', include: ['*.jar'])
    }
    

    Furthermore, as answered by @Diego Giorgini in a related SO post,

    The issue you are experiencing is due to an incompatibility between play-services / firebase sdk v9.0.0 and com.android.support:appcompat-v7 >= 24 (the version released with android-N sdk)

    With this, you may want to try the suggested fix:

    You should be able to fix it by targeting an earlier version of the support library. Like:

    compile 'com.android.support:appcompat-v7:23.4.0'

    You may want to also check the other suggestions in the following SO posts:

    • IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM
    • Android Google Cloud Messaging (GCM) token generation crash after Firebase-related Google Play Services update.

提交回复
热议问题