Android

来源:互联网 发布:美国全球的盟友网络 编辑:程序博客网 时间:2024/06/11 20:11

描述:

在项目中导入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        }    */
原创粉丝点击