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

运行App报错:未指定JDK,Android Studio 3.0.1配置JDK9仍无法运行求助

Fixing "Error running App: No JDK specified" in Android Studio 3.0.1 with JDK 9

Hey there, let's work through this frustrating issue you're hitting. I've dealt with similar problems before, and the root cause here is almost always a compatibility mismatch or a hidden configuration hiccup. Let's break down the solutions step by step:

1. Address the core compatibility issue first

Android Studio 3.0.1 does not officially support JDK 9 — it’s built to work best with JDK 8. The module system and underlying changes in JDK 9 clash with the older tooling in AS 3.0.1, which is likely why your setup isn’t working even with correct environment variables.

My top recommendation: Downgrade to JDK 8. It’s the most stable and fully supported version for this AS release. Once you install JDK 8, update your JAVA_HOME, JDK_HOME, and Path variables to point to the JDK 8 directory instead of JDK 9.

2. Verify your environment variables are actually active

Sometimes we set variables but forget to restart our system or Android Studio, so the changes don’t take effect. Let’s confirm:

  • Open a terminal (Command Prompt on Windows, Terminal on Mac/Linux)
  • Run java -version — this should show JDK 8 once you’ve downgraded (or your intended JDK version)
  • Run echo %JAVA_HOME% (Windows) or echo $JAVA_HOME (Mac/Linux) — this should output the full path to your JDK installation directory

If either command shows the wrong version/path, double-check your environment variable settings, save them, restart your computer, and re-test.

3. Check Android Studio’s global JDK settings (not just the project)

You’ve set the JDK in your project structure, but AS has a global setting that might be overriding this:

  • On Windows/Linux: Go to File > Other Settings > Default Project Structure
  • On Mac: Go to Android Studio > Settings > Build, Execution, Deployment > Build Tools > Gradle
  • Under Gradle JDK, select the path to your JDK 8 installation. Make sure it’s not pointing to JDK 9 anymore.

Alternatively, you can force Gradle to use the correct JDK by editing your project’s root gradle.properties file. Add this line (replace the path with your actual JDK 8 directory):

org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_XXX.jdk/Contents/Home

4. Clear Android Studio’s cache and restart

Corrupted cache can sometimes prevent configuration changes from being applied. Let’s fix that:

  • Go to File > Invalidate Caches / Restart
  • Select Invalidate and Restart — this will clear the cache and reboot AS, forcing it to load your updated JDK settings.

If you insist on using JDK 9, you’ll need to upgrade your Gradle version to at least 4.3 (since older Gradle versions don’t support JDK 9). However, Android Studio 3.0.1 may not play nicely with newer Gradle versions, so this path is riskier. You’d need to:

  • Update the distributionUrl in your project’s gradle/wrapper/gradle-wrapper.properties to point to Gradle 4.3 or higher (e.g., https://services.gradle.org/distributions/gradle-4.3-all.zip)
  • Ensure your app’s build.gradle uses a compatible Android Gradle Plugin version (AS 3.0.1 uses plugin version 3.0.1, which should work with Gradle 4.3, but no guarantees)

But again, downgrading to JDK 8 is the far more reliable solution here.


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 09:13:35