Android - 安卓报错Error:Could not determine artifacts for com.android.support:support-v4:24.0.0:

转载请注明出处:https://blog.csdn.net/mythmayor/article/details/72844505

描述:

在项目中导入Module/Library后,想要添加依赖,添加后可能会产生这样的问题:
/*
    Error:Could not determine artifacts for 
    com.android.support:support-v4:24.0.0: 
    No cached version available for offline mode
*/

解决方案为:

    1.在当前Module(要添加额外依赖的Module)删除" compile 'com.android.support:appcompat-v7:24.0.0' "
    这一依赖。
    2.在values.xml中删除以下内容:
    /*
        <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        </style>
    */
    3.在styles.xml中删除以下内容:
    /*
        <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
            <!-- Customize your theme here. -->
            <item name="colorPrimary">@color/colorPrimary</item>
            <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
            <item name="colorAccent">@color/colorAccent</item>
        </style>
    */
    4.在清单文件中删除以下内容:
    //注意此时要找对清单文件,建议Close All,重新在项目中打开清单文件
    /*
        android:theme="@style/AppTheme"
    */

另一种解决方案(推荐):

    在当前module中的"build.gradle"文件中添加下面信息
    /*
        compile ('com.android.support:appcompat-v7:23.0.1'){
            exclude module :'support-v4' //从v7中排除v4
        }
    */
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值