竹内咲良 2022-04-15 15:29 采纳率: 100%
浏览 160
已结题

Android Studio无法下载annotation.jar

问题遇到的现象和发生背景

根据《第一行代码 第2版》编写BroadcastPractice时,出现如下报错:

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not download annotation.jar (androidx.annotation:annotation:1.0.2)
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download annotation.jar (androidx.annotation:annotation:1.0.2)
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download annotation.jar (androidx.annotation:annotation:1.0.2)
Show Details
Affected Modules: app


app图标显示叉号(app配置有问题)

操作环境、软件版本等信息

软件:Android Studio 3.5

尝试过的解决方法

尝试更改过依赖为 implementation 'androidx.appcompat:appcompat:+',更换网络,换成国内源等方法,一直出现同样的报错。

我想要达到的结果

无报错即可。

  • 写回答

3条回答 默认 最新

  • weixin_42120514 2022-04-15 15:36
    关注

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
  • 竹内咲良 2022-04-15 15:45
    关注

    修改gradle script下的build.gradle文件为以下内容

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
        repositories {
            maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
    
            maven{ url 'https://maven.aliyun.com/repository/google'}
    
            maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
    
            maven{ url 'https://maven.aliyun.com/repository/public'}
    
            maven{ url 'https://maven.aliyun.com/repository/jcenter'}
    
            jcenter()
            //google()
    
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.5.2'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
            google()
            jcenter()
    
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    ```java
    
    
    

    ```

    评论
  • 阿pin 2022-04-15 16:43
    关注

    1.1.0,1.2.0,1.3.0换个版本试一试
    你的整体版本都比较老了,建议都升级到最新版。最近网络屏蔽的厉害,很多外网都无法访问,有条件的可以翻一翻,没条件的试一试阿里云的仓库。

    评论 编辑记录
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 5月1日
  • 已采纳回答 4月23日
  • 创建了问题 4月15日

悬赏问题

  • ¥15 请教一下simulink中S函数相关问题
  • ¥15 Hadoop中eclipse运行问题
  • ¥15 在二层网络中,掩码存在包含关系即可通信
  • ¥15 端口转发器解析失败不知道电脑设置了啥
  • ¥15 Latex算法流程图行号自定义
  • ¥15 关于#python#的问题:我在自己的电脑上运行起来总是报错,希望能给我一个详细的教程,(开发工具-github)
  • ¥40 基于51单片机实现球赛计分器功能
  • ¥15 cs2游戏画面卡住,应用程序sid与指挥者sid不匹配
  • ¥15 实验七:Pandas要有实验截图和代码
  • ¥15 TypeError: Make sure that the iterable only contains strings.