0

I've already read questions about this problem (This and this) and I've tried to apply the solutions to my case but it didn't work for me

The line who causes an error is this

InstanceID instanceID = InstanceID.getInstance(LoginActivity.this);

Whit this error on Log

java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.' is inaccessible to class 'com.google.android.gms.iid.zzd'

Here is my build.gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '25.0.0'

    dexOptions {
        preDexLibraries = false
        javaMaxHeapSize "2g"
    }

    defaultConfig {
        applicationId "there is an id here"
        minSdkVersion 15
        targetSdkVersion 23
        multiDexEnabled true
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
    }

    lintOptions {
        abortOnError false
        disable 'InvalidPackage'
    }

    buildTypes {
        release {
            minifyEnabled false
            //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
}

repositories {
    mavenCentral()
    maven {
        url "https://s3.amazonaws.com/repo.commonsware.com"
    }
}

dependencies {
    compile 'com.android.support:multidex:1.0.0'
    androidTestCompile('com.android.support:multidex-instrumentation:1.0.1') {
        exclude group: 'com.android.support', module: 'multidex'
    }
    compile 'com.commonsware.cwac:cam2:0.4.+'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile project(':viewPagerIndicator')
    compile 'com.facebook.android:facebook-android-sdk:4.26.0' //CAMBIO DA 4.7.0 a 4.26.0
    //compile project(':facebook')
    /*compile files('libs/android-maven-plugin-3.6.0.jar')
    compile files('libs/apache-mime4j-benchmark-0.7.2.jar')
    compile files('libs/apache-mime4j-core-0.7.2.jar')
    compile files('libs/apache-mime4j-dom-0.7.2.jar')
    compile files('libs/apache-mime4j-examples-0.7.2.jar')
    compile files('libs/apache-mime4j-storage-0.7.2.jar')
    compile files('libs/braintree-api-1.2.7.jar')
    compile files('libs/commons-codec-1.6.jar')
    compile files('libs/fluent-hc-4.2.1.jar')
    compile files('libs/httpclient-4.2.1.jar')
    compile files('libs/httpclient-cache-4.2.1.jar')
    compile files('libs/httpcore-4.2.1.jar')
    compile files('libs/httpmime-4.2.1.jar')
    compile files('libs/libGoogleAnalytics.jar')
    compile files('libs/metadata-extractor-2.6.2.jar')
    compile files('libs/xmpcore.jar')*/
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.google.android.gms:play-services-ads:8.3.0'
    compile 'com.google.android.gms:play-services-identity:8.3.0'
    compile 'com.google.android.gms:play-services-gcm:8.3.0'

}
4
  • Try stackoverflow.com/questions/40904466/…. Commented Apr 4, 2018 at 16:36
  • As those play services are very out of date, when did this start to occur? What was the change that triggered it? Commented Apr 4, 2018 at 16:39
  • Upgrade your buildToolsVersion to a more recent one (or comment the line as it's now automatically managed by Android Studio (if you're using Android plugin for Gradle 3.0.0 or higher) Commented Apr 4, 2018 at 16:41
  • After update my Facebook SDK version @weston Commented Apr 5, 2018 at 10:48

1 Answer 1

0

Exclude Support Library from facebook SDK

compile ('com.facebook.android:facebook-android-sdk:4.26.0'){
exclude module: 'support-v4'
exclude group: 'com.android.support'
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.