当前位置:   article > 正文

Android | 开发过程遇到的报错以及解决方法_your build is currently configured to use java 17.

your build is currently configured to use java 17.0.10 and gradle 4.10.1.

注: 此博客为记录个人开发过程中遇到的报错问题以及解决方案。

        由于不同版本环境等因素影响,解决方案对其他人可能无效。

        本博客仅提供一种解决思路,具体问题请具体分析。

  • 报错:Connection timed out: connect
  • 解决:在Gradle目录下的build.gradle中Google()和jcenter()中间增加
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
  1. buildscript {
  2. repositories {
  3. google()
  4. maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
  5. jcenter()
  6. }
  7. }

  • 报错:Gradle报错:
  1. 1: Task failed with an exception.
  2. -----------
  3. * What went wrong:
  4. A problem was found with the configuration of task ':app:checkDebugManifest' (type 'CheckManifest').
  5. - Type 'com.android.build.gradle.internal.tasks.CheckManifest' property 'manifest' has @Input annotation used on property of type 'File'.
  6. Reason: A property of type 'File' annotated with @Input cannot determine how to interpret the file.
  7. Possible solutions:
  8. 1. Annotate with @InputFile for regular files.
  9. 2. Annotate with @InputDirectory for directories.
  10. 3. If you want to track the path, return File.absolutePath as a String and keep @Input.
  11. Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#incorrect_use_of_input_annotation for more details about this problem.
  12. * Try:
  13. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  14. ==============================================================================
  • 解决:将gradle-wrapper.properties中的gradle版本降级
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip

                修改为

distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

  • 报错:降级 Gradle 之后可能会出现 Gradle 与 Java 版本不匹配
  1. Unsupported Java.
  2. Your build is currently configured to use Java 17.0.6 and Gradle 6.8.3.
Java版本与Gradle版本对应
Java versionFirst Gradle version to support it
82.0
94.3
104.7
115.0
125.4
136.0
146.3
156.7
167.0
177.3
187.5
197.6
208.1

                注:在Android Studio修改Java版本方法:

  • 报错:Gradle时报错:
  1. Caused by: org.gradle.api.internal.plugins.PluginApplicationException:
  2. Failed to apply plugin [id 'com.android.application']
  1. # Project-wide Gradle settings.
  2. # IDE (e.g. Android Studio) users:
  3. # Gradle settings configured through the IDE *will override*
  4. # any settings specified in this file.
  5. # For more details on how to configure your build environment visit
  6. # http://www.gradle.org/docs/current/userguide/build_environment.html
  7. # Specifies the JVM arguments used for the daemon process.
  8. # The setting is particularly useful for tweaking memory settings.
  9. # Default value: -Xmx10248m -XX:MaxPermSize=256m
  10. # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
  11. # When configured, Gradle will run in incubating parallel mode.
  12. # This option should only be used with decoupled projects. More details, visit
  13. # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
  14. # org.gradle.parallel=true
  15. android.overridePathCheck=true

  • 报错:Gradle时报错:
Invalid escape sequence at line 1 column 26 path $[0].name
  1. # Project-wide Gradle settings.
  2. # IDE (e.g. Android Studio) users:
  3. # Gradle settings configured through the IDE *will override*
  4. # any settings specified in this file.
  5. # For more details on how to configure your build environment visit
  6. # http://www.gradle.org/docs/current/userguide/build_environment.html
  7. # Specifies the JVM arguments used for the daemon process.
  8. # The setting is particularly useful for tweaking memory settings.
  9. # Default value: -Xmx10248m -XX:MaxPermSize=256m
  10. # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
  11. # When configured, Gradle will run in incubating parallel mode.
  12. # This option should only be used with decoupled projects. More details, visit
  13. # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
  14. # org.gradle.parallel=true
  15. android.overridePathCheck=true
  16. org.gradle.jvmargs=-Dfile.encoding=UTF-8
  • 报错:想通过 Android 连接本地搭建一个 SpringBoot 服务器,在浏览器浏览时是 http://127.0.0.1:8080,在 Android 运行时报错:
java.net.ConnectException: Failed to connect to /127.0.0.1:8080
http://192.168.173.132:8080
http://10.0.2.2:8080
  • 报错:
  • 参考:
  • 解决:
  • 报错:
  • 参考:
  • 解决:

(未完待续...) 

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号