Android Studio报错问题集锦


Android Studio使用过程中坑太多,动不动就报错,每次出现问题都是上百度去搜索,需要花费很大的时间和精力才能解决掉问题。

为了以后更高效的使用这款工具,在这里记录下来我已经踩过的坑和即将要踩的坑,希望能为自己也为别人提供些便利,共同学习,共同进步。

公司和家中的电脑用了两个不同版本的studio,先贴下截图做个记录

报错1:Could not find any version that matches com.android.support:appcompat-v7:29.+.

Could not find any version that matches com.android.support:appcompat-v7:29.+.
Versions that do not match:
    26.0.0-alpha1
    25.3.1
    25.3.0
    25.2.0
    25.1.1
    + 50 more
Searched in the following locations:
    file:/E:/Android/sdk/extras/m2repository/com/android/support/appcompat-v7/maven-metadata.xml
    file:/E:/Android/sdk/extras/m2repository/com/android/support/appcompat-v7/
    file:/E:/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/maven-metadata.xml
    file:/E:/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/
    file:/E:/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/maven-metadata.xml
    https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/maven-metadata.xml
    https://jcenter.bintray.com/com/android/support/appcompat-v7/maven-metadata.xml
    https://jcenter.bintray.com/com/android/support/appcompat-v7/
Required by:
    project :app

Please install the Android Support Repository from the Android SDK Manager.
Open Android SDK Manager

解决方案:找到自己的项目文件,修改build.gradle文件(注意是Module:app,不是Project下的)

找到这一段

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:29.+'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

将这一行implementation 'com.android.support:appcompat-v7:29.+'

改为 implementation 'com.android.support:appcompat-v7:26.+'
或者 implementation 'com.android.support:appcompat-v7:+'

报错2:Sources for 'Android API 26 Platform' not found

这是 Android Studio 关联不上源码导致的

找到~/Library/Preferences/AndroidStudioXXX/options/jdk.table.xml这个文件,手动配置 API 26 Sources 文件路径

Android Studio 常见问题

报错3:导入他人工程时报错CouldnotinstallGradledistributionfrom'https://services.gradle.org/..."

修改build.gradle文件(注意是Module:app)

把dependencies这一段替换成自己可用项目的

报错4:

0

优质内容筛选与推荐>>
1、android小Demo--圆球跟随手指轨迹移动
2、The Architecture of the MOSS Seach
3、基于微软开发平台构建和使用私有NuGet托管库
4、Oracle:导出报ORA-01455: 转换列溢出整数数据类型
5、BZOJ 2751: [HAOI2012]容易题(easy)


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号





    联系我们

    欢迎来到TinyMind。

    关于TinyMind的内容或商务合作、网站建议,举报不良信息等均可联系我们。

    TinyMind客服邮箱:support@tinymind.net.cn