我已经阅读了有关此问题的问题(This和this)并且我已尝试将解决方案应用于我的案例,但它并不适用于我
导致错误的行是
InstanceID instanceID = InstanceID.getInstance(LoginActivity.this);
在日志
上显示此错误java.lang.IllegalAccessError:Method' void android.support.v4.content.ContextCompat&#39。上课是无法进入的 ' com.google.android.gms.iid.zzd'
这是我的build.gradle文件
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'
}
答案 0 :(得分:0)
从facebook SDK
compile ('com.facebook.android:facebook-android-sdk:4.26.0'){
exclude module: 'support-v4'
exclude group: 'com.android.support'
}