Android | 开发过程遇到的报错以及解决方法 报错:Connection timed out: connect

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

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

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

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

  • 报错:Gradle报错:
1: Task failed with an exception.

-----------

* What went wrong:

A problem was found with the configuration of task ':app:checkDebugManifest' (type 'CheckManifest').

  - Type 'com.android.build.gradle.internal.tasks.CheckManifest' property 'manifest' has @Input annotation used on property of type 'File'.

   

    Reason: A property of type 'File' annotated with @Input cannot determine how to interpret the file.

   

    Possible solutions:

      1. Annotate with @InputFile for regular files.

      2. Annotate with @InputDirectory for directories.

      3. If you want to track the path, return File.absolutePath as a String and keep @Input.

   

    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.

* Try:

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.

==============================================================================
  • 解决:将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 版本不匹配
Unsupported Java. 
Your build is currently configured to use Java 17.0.6 and Gradle 6.8.3.
Java版本与Gradle版本对应
Java version First Gradle version to support it
8 2.0
9 4.3
10 4.7
11 5.0
12 5.4
13 6.0
14 6.3
15 6.7
16 7.0
17 7.3
18 7.5
19 7.6
20 8.1

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

  • 报错:Gradle时报错:
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: 
Failed to apply plugin [id 'com.android.application']
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.overridePathCheck=true

  • 报错:
  • 参考:
  • 解决:

(未完待续...) 

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-28 23:34:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-28 23:34:03       100 阅读
  3. 在Django里面运行非项目文件

    2024-03-28 23:34:03       82 阅读
  4. Python语言-面向对象

    2024-03-28 23:34:03       91 阅读

热门阅读

  1. 移除元素——leetcode[1]

    2024-03-28 23:34:03       37 阅读
  2. SQL优化

    2024-03-28 23:34:03       41 阅读
  3. c++部分题

    2024-03-28 23:34:03       46 阅读
  4. 苹果病虫检测

    2024-03-28 23:34:03       38 阅读
  5. 防抖和节流的概念及区别

    2024-03-28 23:34:03       37 阅读
  6. 2024年数字IC秋招-沐曦-GPU验证-笔试题

    2024-03-28 23:34:03       38 阅读
  7. 【 [蓝桥杯 2013 省 B] 翻硬币】

    2024-03-28 23:34:03       45 阅读
  8. 初入C++

    初入C++

    2024-03-28 23:34:03      42 阅读
  9. 二、数据库管理员密码管理

    2024-03-28 23:34:03       38 阅读
  10. 看书标记【数据科学:R语言实战 5】

    2024-03-28 23:34:03       45 阅读