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

Android Studio 3.0.1遇Gradle刷新失败及URI未注册问题求助

Troubleshooting Two Common Issues in Android Studio 3.0.1

Hey there, let's break down and fix the two problems you're encountering with Android Studio 3.0.1—these are pretty typical hurdles, so we'll work through them step by step.

1. Fixing "Gradle project refresh failed" Error

Since you've already tried reinstalling Studio/SDK and adjusting Gradle paths, let's dive into more targeted solutions:

  • Verify Gradle Plugin & Version Compatibility
    Android Studio 3.0.1 requires the Gradle plugin version 3.0.1, paired with Gradle version 4.1 or 4.4 (these are the most stable matches). Double-check your project files:

    • In your root build.gradle, ensure the plugin dependency is correct:
      buildscript {
          repositories {
              google()
              jcenter()
          }
          dependencies {
              classpath 'com.android.tools.build:gradle:3.0.1'
          }
      }
      
    • In gradle/wrapper/gradle-wrapper.properties, set the matching Gradle distribution URL:
      distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
      
  • Clear Android Studio Caches
    Corrupted caches often cause refresh failures. Go to File > Invalidate Caches / Restart, then select Invalidate and Restart. This will clear stale cache files and restart Studio—this alone fixes many Gradle-related glitches.

  • Fix Repository Access Issues
    If Gradle can't download dependencies, check your network or switch to a reliable mirror:

    • Replace the default repositories in your build.gradle with domestic mirrors to avoid connectivity issues:
      repositories {
          maven { url 'https://maven.aliyun.com/repository/google' }
          maven { url 'https://maven.aliyun.com/repository/jcenter' }
      }
      
    • If you use a proxy, confirm it's correctly configured in Settings > Appearance & Behavior > System Settings > HTTP Proxy.
  • Validate Local Gradle Installation
    If you're using a manually specified Gradle directory, make sure the folder is intact (no missing files) and the version matches the plugin requirement. A corrupted Gradle zip can cause silent failures.

2. Resolving "URI not registered" for http://schemas.android.com/apk/res/android

This error usually stems from missing SDK components or incomplete project indexing. Try these fixes:

  • Resync Your Project with Gradle
    Click the Sync Project with Gradle Files button (the elephant icon in the toolbar). This triggers Studio to reindex your project resources and often registers the missing URI automatically.

  • Check SDK Platform Installation
    Ensure you have the SDK Platform matching your project's compileSdkVersion installed:

    1. Open Tools > Android > SDK Manager
    2. Go to the SDK Platforms tab, find the version matching your project's compileSdkVersion (e.g., if your build.gradle has compileSdkVersion 26, install Android 8.0 (API 26))
    3. Click Apply to install the missing platform.
  • Fix Project Structure Configuration
    Go to File > Project Structure, then navigate to the Modules tab. Confirm:

    • The Compile SDK Version matches the installed SDK platform
    • The Build Tools Version is compatible (for 3.0.1 plugin, build tools 26.0.2 or later works well)
  • Manually Register the URI
    If the above steps don't work, manually add the schema to Studio:

    1. Go to Settings > Languages & Frameworks > Schemas and DTDs
    2. Click the + button in the top-right corner
    3. Enter http://schemas.android.com/apk/res/android as the URI
    4. For the "File" field, browse to your local SDK directory, then select platforms/android-[your compileSdkVersion]/data/res/values/attrs.xml
    5. Click OK to save, then restart Studio.

Give these steps a try—they should resolve both issues for you.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.20 10:17:03