Jake Wharton の VPIなど、いくつかのライブラリをアプリに使用しています
これが私のbuild.gradle
ファイルです:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':SlidingMenu:library')
compile project(':Android-ViewPagerIndicator:library')
compile project(':aFileChooser:aFileChooser')
compile project(':Crouton:library')
compile project(':ActionBarSherlock:actionbarsherlock')
compile project(':ListViewAnimations:library')
compile project(':Android-Universal-Image-Loader:library')
compile project(':drag-sort-listview:library')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
sourceSets {
main {
manifest.srcFile 'MyMine/AndroidManifest.xml'
java.srcDirs = ['MyMine/src']
resources.srcDirs = ['MyMine/src']
aidl.srcDirs = ['MyMine/src']
renderscript.srcDirs = ['MyMine/src']
res.srcDirs = ['MyMine/res']
assets.srcDirs = ['MyMine/assets']
}
instrumentTest.setRoot('tests')
}
}
settings.gradle
:
include ':ActionBarSherlock:actionbarsherlock'
include ':ListViewAnimations:library'
include ':drag-sort-listview:library'
include ':Android-ViewPagerIndicator:library'
include ':Crouton:library'
include ':Android-Universal-Image-Loader:library'
include ':aFileChooser:aFileChooser'
include ':SlidingMenu:library'
./gradlew build
出力は次のとおりです。
[...]
:prepareDebugDependencies
:compileDebugAidl
:generateDebugBuildConfig
:mergeDebugAssets
:compileDebugRenderscript
:mergeDebugResources
:processDebugManifest
:processDebugResources
/Users/bicou/AndroidStudioProjects/MyMine/build/res/all/debug/values-v11/values.xml:76: error: Error: No resource found that matches the given name: attr 'vpiTabPageIndicatorStyle'.
/Users/bicou/AndroidStudioProjects/MyMine/build/res/all/debug/values-v11/values.xml:75: error: Error: No resource found that matches the given name: attr 'vpiTitlePageIndicatorStyle'.
/Users/bicou/AndroidStudioProjects/MyMine/build/res/all/debug/values-v11/values.xml:24: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.TabPageIndicator'.
/Users/bicou/AndroidStudioProjects/MyMine/build/res/all/debug/values-v11/values.xml:81: error: Error: No resource found that matches the given name: attr 'footerColor'.
/Users/bicou/AndroidStudioProjects/MyMine/build/res/all/debug/values-v11/values.xml:83: error: Error: No resource found that matches the given name: attr 'footerIndicatorHeight'.
/Users/bicou/AndroidStudioProjects/MyMine/build/res/all/debug/values-v11/values.xml:84: error: Error: No resource found that matches the given name: attr 'footerIndicatorStyle'.
/Users/bicou/AndroidStudioProjects/MyMine/build/res/all/debug/values-v11/values.xml:82: error: Error: No resource found that matches the given name: attr 'footerLineHeight'.
/Users/bicou/AndroidStudioProjects/MyMine/build/res/all/debug/values-v11/values.xml:87: error: Error: No resource found that matches the given name: attr 'selectedBold'.
/Users/bicou/AndroidStudioProjects/MyMine/build/res/all/debug/values-v11/values.xml:86: error: Error: No resource found that matches the given name: attr 'selectedColor'.
:processDebugResources FAILED
ご覧のとおり、VPI 関連のものだけです。しかし、それらは存在します:
$ grep vpiTabPageIndicatorStyle Android-ViewPagerIndicator/library/res/values/*
Android-ViewPagerIndicator/library/res/values/vpi__attrs.xml: <attr name="vpiTabPageIndicatorStyle" format="reference"/>
Android-ViewPagerIndicator/library/res/values/vpi__styles.xml: <item name="vpiTabPageIndicatorStyle">@style/Widget.TabPageIndicator</item>
これが私のvalues-v11/themes.xml
ファイルです: (不要な部分は削除されています)
<style name="MyMineTheme.VPI" parent="MyMineTheme">
<item name="vpiTitlePageIndicatorStyle">@style/MyMineTitlePageIndicator</item>
<item name="vpiTabPageIndicatorStyle">@style/MyMineTabPageIndicator</item>
</style>
どうしたの?私はもう走っ./gradlew clean && ./gradlew build
た。
興味深いこと: 私は Eclipse でこの問題を何週間も抱えていました。アプリをコンパイルするには、[プロジェクト] > [クリーン] > [すべて] を実行して、もう一度ビルドし直す必要がありました。Android Studio に切り替えた今でも、まだ機能しています。しかし、Studio は (まだ) ビルドに Gradle を使用していません。