You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Studio新建项目时Gradle同步失败(Error (26,13))求解决方案

Hey there, sorry to hear you're hitting this frustrating Gradle sync error every time you spin up a new Android Studio project. Let's walk through the most common fixes for this Error (26,13) issue—since it typically stems from version mismatches or cached glitches:

Common Fixes for Gradle Sync Error (26,13)

1. Verify Gradle Plugin & Gradle Version Compatibility

The Android Gradle Plugin (AGP) and Gradle itself have strict version matching rules. A mismatch here is one of the top causes for this error:

  • Open your project's root build.gradle file (the one for the entire project, not the app module)
  • Look for this line in the dependencies block: classpath "com.android.tools.build:gradle:x.x.x"
  • Cross-check this AGP version against the required Gradle version (e.g., AGP 7.4.2 needs Gradle 7.5; AGP 8.0.0 requires Gradle 8.0). You can find the official compatibility table directly in Android Studio by going to Settings > Build, Execution, Deployment > Build Tools > Gradle
  • Update either the AGP version or Gradle version to match, then click "Sync Now" to let Studio download the correct files if needed

2. Check or Remove Build Tools Version

Sometimes the buildToolsVersion declaration in your module's build.gradle causes conflicts:

  • Open app/build.gradle (your module-level config)
  • Look for buildToolsVersion "xx.x.x" inside the android block
  • Either make sure this version is installed in your SDK Manager, or remove the line entirely—modern AGP versions automatically handle the Build Tools version for you, so this line is often unnecessary now

3. Wipe Caches & Restart Android Studio

Corrupted Gradle or Studio caches are a frequent culprit:

  • Go to File > Invalidate Caches...
  • Check the box for Invalidate and Restart and confirm. This will clear all cached data and restart Studio fresh
  • Once it boots back up, try syncing your project again

4. Validate Proxy Settings

If you're behind a corporate or local proxy, incorrect settings can block Gradle from downloading dependencies:

  • Head to Settings > Appearance & Behavior > System Settings > HTTP Proxy
  • Ensure your proxy configuration is correct, or temporarily switch to a direct internet connection (if possible) to test if the sync works without proxy interference

5. Check Local Gradle Configuration

Double-check that Studio is using the Gradle version specified by your project's wrapper:

  • Open Settings > Build, Execution, Deployment > Build Tools > Gradle
  • Under Use Gradle from, select 'gradle-wrapper.properties' file instead of a local Gradle installation. This ensures you're using the exact version your project was set up to use, avoiding version mismatches

6. Dig Into the Full Error Log

The Error (26,13) is just a line/column reference—you need the actual error message to pinpoint the issue:

  • Open the Build tab at the bottom of Android Studio
  • Click the Toggle View button (looks like a list icon) to switch to the detailed log view
  • Navigate to line 26, column 13 in the relevant Gradle file (either project or module level) to see exactly what's causing the syntax or configuration error

If none of these fixes resolve your issue, please share the full content of your project-level build.gradle and module-level app/build.gradle files—this will let us zero in on the exact problem!

内容的提问来源于stack exchange,提问作者TedsAttic

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 06:43:09