Warning:No JDK specified for module

本文介绍了解决Android Studio中出现的unknownfacettypejavagradle错误的方法。该错误通常是由于缺少AndroidSupport插件导致的。解决步骤包括在设置中启用AndroidSupport插件并重启IDE。

unknown facet type javagradle



原因:缺少Android Support插件 
解决:进入File-》Settings-》Plugins 
勾选Android Support选项 
重启AS即可

WARNING: A restricted method in java.lang.System has been called WARNING: java.lang.System::load has been called by org.fusesource.jansi.internal.JansiLoader in an unnamed module (file:/D:/Environment/apache-maven-3.8.8/lib/jansi-2.4.0.jar) WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module WARNING: Restricted methods will be blocked in a future release unless native access is enabled WARNING: A terminally deprecated method in sun.misc.Unsafe has been called WARNING: sun.misc.Unsafe::objectFieldOffset has been called by com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper (file:/D:/Environment/apache-maven-3.8.8/lib/guava-25.1-android.jar) WARNING: Please consider reporting this to the maintainers of class com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.046 s [INFO] Finished at: 2025-06-13T09:32:08+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException
06-14
PS D:\Android\skin2> ./gradlew build --info WARNING: A restricted method in java.lang.System has been called WARNING: java.lang.System::load has been called by net.rubygrapefruit.platform.internal.NativeLibraryLoader in an unnamed module (file:/C:/Users/86177/.gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13/lib/native-platform-0.22-milestone-28.jar) WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module WARNING: Restricted methods will be blocked in a future release unless native access is enabled Initialized native services in: C:\Users\86177\.gradle\native Initialized jansi services in: C:\Users\86177\.gradle\native Found daemon DaemonInfo{pid=25984, address=[98f52f11-5422-4822-a531-517066b0e039 port:43222, addresses:[/127.0.0.1]], state=Idle, lastBusy=1761229107209, context=Defaul tDaemonContext[uid=05f9d51e-3dfa-44e0-b71f-69781af5ef3b,javaHome=D:\Program Files\Android\Android Studio\jbr,javaVersion=21,javaVendor=JetBrains s.r.o.,daemonRegistryDi r=C:\Users\86177\.gradle\daemon,pid=25984,idleTimeout=10800000,priority=NORMAL,applyInstrumentationAgent=true,nativeServicesMode=ENABLED,daemonOpts=-Xmx2048m,-Dfile.encoding=UTF-8,-Duser.country=CN,-Duser.language=zh,-Duser.variant]} however its context does not match the desired criteria. JVM is incompatible. Wanted: DaemonRequestContext{jvmCriteria=D:\Program Files\Java\jdk-24 (no JDK specified, using current Java home), daemonOpts=[-Xmx2048m, -Dfile.encoding=UTF-8, -Duser.country=CN, -Duser.language=zh, -Duser.variant], applyInstrumentationAgent=true, nativeServicesMode=ENABLED, priority=NORMAL} Actual: DefaultDaemonContext[uid=05f9d51e-3dfa-44e0-b71f-69781af5ef3b,javaHome=D:\Program Files\Android\Android Studio\jbr,javaVersion=21,javaVendor=JetBrains s.r.o.,da emonRegistryDir=C:\Users\86177\.gradle\daemon,pid=25984,idleTimeout=10800000,priority=NORMAL,applyInstrumentationAgent=true,nativeServicesMode=ENABLED,daemonOpts=-Xmx2048m,-Dfile.encoding=UTF-8,-Duser.country=CN,-Duser.language=zh,-Duser.variant] Looking for a different daemon... The client will now receive all logging from the daemon (pid: 39468). The daemon log file: C:\Users\86177\.gradle\daemon\8.13\daemon-39468.out.log Starting 4th build in daemon [uptime: 25 mins 44.983 secs, performance: 100%, GC rate: 0.00/s, heap usage: 0% of 2 GiB] Using 16 worker leases. Now considering [D:\Android\skin2] as hierarchies to watch Watching the file system is configured to be enabled if available File system watching is active Starting Build Settings evaluated using settings file 'D:\Android\skin2\settings.gradle.kts'. Projects loaded. Root project using build file 'D:\Android\skin2\build.gradle.kts'. Included projects: [root project 'skin', project ':app'] > Configure project : Evaluating root project 'skin' using build file 'D:\Android\skin2\build.gradle.kts'. Resolved plugin [id: 'com.android.application', version: '8.13.0', apply: false] > Configure project :app Evaluating project ':app' using build file 'D:\Android\skin2\app\build.gradle.kts'. Resolved plugin [id: 'com.android.application', version: '8.13.0'] Using default execution profile All projects evaluated. Task name matched 'build' Selected primary task 'build' from project : FAILURE: Build failed with an exception. * What went wrong: Could not determine the dependencies of task ':app:test'. > Could not create task ':app:testDebugUnitTest'. > Could not create task of type 'AndroidUnitTest'. > Could not create an instance of type org.gradle.api.internal.tasks.testing.DefaultTestTaskReports. > Could not create an instance of type org.gradle.api.reporting.internal.DefaultReportContainer. > Type T not present * Try: > Run with --stacktrace option to get the stack trace. > Run with --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. BUILD FAILED in 3s
最新发布
10-24
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值