添加依赖后出现com.google.android.gms.internal.zzbck类找不到错误求助
Hey there! Let's troubleshoot that annoying cannot access zzbck error you're seeing after adding those two dependencies. Here's what's going on and how to fix it:
This error pops up due to two key dependency conflicts in your project:
- Mismatched Android Support Library versions: You're mixing
26.1.0(for most support components likeappcompat-v7,design) and26.4.0(forsupport-core-ui). Android requires all support library components to use the exact same version to avoid compatibility issues. - Google Play Services version conflict: The new
vas3g-api:2.0.0dependency likely relies on a different version of Google Play Services than your project's current11.4.2version. This mismatch breaks access to internal GMS classes likecom.google.android.gms.internal.zzbck.
1. Unify All Android Support Library Versions
Update every support-related dependency to the same version (we'll use 26.4.0 since you already added support-core-ui at this version):
2. Force a Unified Google Play Services Version
Add a resolution strategy to your android block to ensure all dependencies use the same GMS version (your project's 11.4.2, or adjust if vas3g-api requires a higher compatible version).
3. Optional: Use Specific GMS Modules Instead of the Full Package
Instead of including the entire play-services library (which is bloated and prone to conflicts), only add the specific GMS modules your project actually needs (e.g., play-services-maps for maps, play-services-gcm for push notifications). This reduces APK size and conflict risks.
Here's how your updated build file should look:
apply plugin: 'com.android.application' android { compileSdkVersion 26 buildToolsVersion '26.0.2' defaultConfig { applicationId "com.arizeh.arizeh" minSdkVersion 17 targetSdkVersion 22 multiDexEnabled true versionCode 31 versionName "3.0.5" useLibrary 'org.apache.http.legacy' testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" manifestPlaceholders = [ manifestApplicationId : "", onesignal_app_id : "", onesignal_google_project_number: "" ] } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility 1.8 targetCompatibility 1.8 } // Add this resolution strategy to force unified dependency versions configurations.all { resolutionStrategy { force 'com.google.android.gms:play-services:11.4.2' force 'com.android.support:support-core-ui:26.4.0' force 'com.android.support:appcompat-v7:26.4.0' force 'com.android.support:design:26.4.0' force 'com.android.support:cardview-v7:26.4.0' force 'com.android.support:percent:26.4.0' force 'com.android.support:support-compat:26.4.0' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) // Unified support library versions compile 'com.android.support:appcompat-v7:26.4.0' compile 'com.android.support:design:26.4.0' compile 'com.android.support:cardview-v7:26.4.0' compile 'com.android.support:percent:26.4.0' compile 'com.android.support:support-compat:26.4.0' compile "com.android.support:support-core-ui:26.4.0" // Replace with specific GMS modules if possible (example below) // compile 'com.google.android.gms:play-services-maps:11.4.2' // compile 'com.google.android.gms:play-services-gcm:11.4.2' compile 'com.google.android.gms:play-services:11.4.2' // Remaining dependencies stay the same testCompile 'junit:junit:4.12' compile 'uk.co.chrisjenx:calligraphy:2.1.0' compile 'com.google.code.gson:gson:2.8.0' compile 'com.koushikdutta.ion:ion:2.+' compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.shawnlin:number-picker:2.4.2' compile 'com.astuetz:pagerslidingtabstrip:1.0.1' compile 'com.android.support:multidex:1.0.2' compile 'com.daimajia.easing:library:2.0@aar' compile 'com.daimajia.androidanimations:library:2.2@aar' compile 'com.zarinpal:purchase:0.0.3-beta' compile 'com.squareup.retrofit2:retrofit:2.3.0' compile 'com.squareup.retrofit2:converter-gson:2.3.0' implementation 'com.rahnema.vas3gapi:vas3g-api:2.0.0' } apply plugin: 'com.google.gms.google-services'
After updating the build file, run ./gradlew clean build (or use the "Clean Project" option in Android Studio) to clear cached dependencies and recompile your project. This ensures all new versions are properly synced.
内容的提问来源于stack exchange,提问作者amirhesni

