2016-12-01 91 views
0

嘗試添加的Android工作室「無法解析:com.android.support:support-core-utils:23.2.1」

compile "com.android.support:support-core-utils:23.2.1" 

到的build.gradle我的移動應用程序時,我遇到了這個錯誤。這裏是整個的build.gradle(移動) 應用插件:「com.android.application」

android { 
    compileSdkVersion 23 
    buildToolsVersion "21.1.2" 
    defaultConfig { 
     applicationId "com.xxxxxxx.sam.collegegrader" 
     minSdkVersion 10 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    wearApp project(':wear') 
    compile 'com.google.android.gms:play-services:9.8.0' 
    compile 'com.android.support:appcompat-v7:23.4.0' 
    compile 'com.android.support:design:23.4.0' 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:support-core-utils:23.2.1' 
} 

SDK Manager

這是我的第一個Android應用程序的話,我可能只是做一個初學者的錯誤。這裏有步驟解決這個問題,我已經採取了:

Failed to resolve: com.android.support:appcompat-v7:15.+ - 沒有足夠的支持庫下載

https://developer.android.com/studio/intro/update.html#sdk-manager - 跟着教程添加庫

https://developer.android.com/topic/libraries/support-library/setup.html#using-apis - 增加編譯到的build.gradle(移動)

failed to resolve com.android.support:appcompat-v7:22 and com.android.support:recyclerview-v7:21.1.2 - 我相信,我在的build.gradle正確的版本#(23.2.1)

這裏就是我tryi NG使用Android:主題= 「@風格/ ThemeOverlay.AppCompat.Dark.Actionbar」 RES /佈局/ activity_view_college.xml Here is where I am trying to use android:theme="@style/ThemeOverlay.AppCompat.Dark.Actionbar"

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context="com.xxxxxx.sam.collegegrader.ViewCollegeActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/app_bar_layout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.Actionbar" 
     android:fitsSystemWindows="true" > 
    </android.support.design.widget.AppBarLayout> 

    <!--<TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="@dimen/text_margin" 
     android:text="@string/large_text" />--> 


</android.support.design.widget.CoordinatorLayout> 

styles.xml

<resources> 

    <!-- Base application theme. --> 
    <style name="AppTheme" parent="Theme.AppCompat"> 
     <!-- Customize your theme here. --> 
     <item name="colorPrimary">@color/colorPrimary</item> 
     <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
     <item name="colorAccent">@color/colorAccent</item> 
    </style> 

    <style name="AppTheme.NoActionBar"> 
     <item name="windowActionBar">false</item> 
     <item name="windowNoTitle">true</item> 
    </style> 

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> 

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> 

</resources> 

styles.xml(V21 )

<resources> 

    <style name="AppTheme.NoActionBar"> 
     <item name="windowActionBar">false</item> 
     <item name="windowNoTitle">true</item> 
     <item name="android:windowDrawsSystemBarBackgrounds">true</item> 
     <item name="android:statusBarColor">@android:color/transparent</item> 
    </style> 
</resources> 

回答

1

因爲support-core-utils庫是v23.2.1的V4支持庫的一部分,你得到這個錯誤。

隨着v24.2.0的發佈,v4支持庫已拆分爲幾個較小的模塊,其中之一爲support-core-utils。有關拆分的更多信息,請查看以下鏈接:https://developer.android.com/topic/libraries/support-library/revisions.html#24-2-0-v4-refactor

因此,解決您的問題的方法是使用更新版本的support-core-utils庫,例如25.0.1

+0

謝謝!還有一件事:我試圖添加這個庫來最終解決錯誤:(13,24)找不到與給定名稱相匹配的資源(在'theme'處,值爲'@ style/ThemeOverlay.AppCompat.Dark.Actionbar') 。我仍然有這個錯誤,我認爲它包含在support-core-utils中。我是否需要在包含操作欄的xml文件中聲明某些內容? – kir13y

+0

此主題包含在似乎存在於build.gradle腳本中的appcompat庫中。你是在佈局中直接使用這種風格,還是在styles.xml中聲明?你可以使用這種風格的佈局/文件更新問題嗎? –

+0

我用更多的信息更新了這個問題。我在styles.xml和其他幾個地方都使用它,都是拋出錯誤。 – kir13y

相關問題