android 新手, hello world 无法编译。。

查看 485|回复 48
chopin1998519
OP
  
@ExplodingFKL
确实有有一堆错误。。
最后一段这样, 能看出什么吗?
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] A new daemon was started but could not be connected to: pid=DaemonInfo{pid=261152, address=[0c0205be-28f5-4060-bc75-b4f2fefe660c port:43841, addresses:[/127.0.0.1]], state=Busy, lastBusy=1685421977961, context=DefaultDaemonContext[uid=bd402a2c-565c-485a-845d-febf686b1655,javaHome=/usr/lib/jvm/java-17-oracle,daemonRegistryDir=/home/marco/.gradle/daemon,pid=261152,idleTimeout=10800000,priority=NORMAL,daemonOpts=--add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xmx2048m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]}, address= [0c0205be-28f5-4060-bc75-b4f2fefe660c port:43841, addresses:[/127.0.0.1]]. See https://docs.gradle.org/8.0/userguide/troubleshooting.html#network_connection for more details.
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Run with --scan to get full insights.
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is:
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] org.gradle.launcher.daemon.client.NoUsableDaemonFoundException: A new daemon was started but could not be connected to: pid=DaemonInfo{pid=261152, address=[0c0205be-28f5-4060-bc75-b4f2fefe660c port:43841, addresses:[/127.0.0.1]], state=Busy, lastBusy=1685421977961, context=DefaultDaemonContext[uid=bd402a2c-565c-485a-845d-febf686b1655,javaHome=/usr/lib/jvm/java-17-oracle,daemonRegistryDir=/home/marco/.gradle/daemon,pid=261152,idleTimeout=10800000,priority=NORMAL,daemonOpts=--add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xmx2048m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]}, address= [0c0205be-28f5-4060-bc75-b4f2fefe660c port:43841, addresses:[/127.0.0.1]]. See https://docs.gradle.org/8.0/userguide/troubleshooting.html#network_connection for more details.
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:172)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:99)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:57)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:167)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.cli.DefaultCommandLineActionFactory$ParseAndBuildAction.execute(DefaultCommandLineActionFactory.java:259)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.cli.DefaultCommandLineActionFactory$ParseAndBuildAction.execute(DefaultCommandLineActionFactory.java:230)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.cli.DebugLoggerWarningAction.execute(DebugLoggerWarningAction.java:82)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.cli.DebugLoggerWarningAction.execute(DebugLoggerWarningAction.java:30)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.cli.WelcomeMessageAction.execute(WelcomeMessageAction.java:96)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.cli.WelcomeMessageAction.execute(WelcomeMessageAction.java:40)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.cli.NativeServicesInitializingAction.execute(NativeServicesInitializingAction.java:44)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.cli.NativeServicesInitializingAction.execute(NativeServicesInitializingAction.java:26)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:41)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:26)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.cli.DefaultCommandLineActionFactory$WithLogging.execute(DefaultCommandLineActionFactory.java:361)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.Main.doAction(Main.java:35)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:50)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.launcher.GradleMain.main(GradleMain.java:34)
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2023-05-30T12:46:17.979+0800 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
taken   
代理没配置好 baby
ExplodingFKL   
@chopin1998519 你把所有代理相关的配置清除或者在执行命令的时候加上 --no-daemon 参数再看看详细结果
mineralsalt   
网络问题, 鉴定完毕
skyinu   
可以用阿里云的 maven 仓库试一下,可以规避网络问题
BigMikey   
网络问题,我是全局的,所以没毛病,系统是 MacOS ,/Doge
iovekkk   
在~/.gradle 目录下创建 init.gradle 文件
文件内容如下:
allprojects {
buildscript {
repositories {
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url "https://maven.aliyun.com/repository/gradle-plugin/"}
}
}
repositories {
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url "https://maven.aliyun.com/repository/gradle-plugin/"}
}
println "${it.name}: Aliyun maven mirror injected"
}
创建完毕之后,重启 Android studio 即可
kaedea   
网络问题,不仅要开 HTTP 代理,还要开 socket 代理。
ExplodingFKL   
阿里云是个大坑 ... 而且在没有其他签名校验的情况下可能出现供应链攻击,啥时候 maven 每个文件带 gpg 签名就好了
superedlimited   
@chopin1998519 悄悄问一下,你的 proxy 是在这里设置的么?

您需要登录后才可以回帖 登录 | 立即注册

返回顶部