我正試圖在我的應用中實現底部欄。我嘗試了好幾種庫,例如當api級別小於23時,無法集成android底部欄
- https://github.com/roughike/BottomBar
- https://github.com/aurelhubert/ahbottomnavigation
- https://github.com/sephiroth74/Material-BottomNavigation
但問題是,當遵守SDK版本低於23,我不能集成任何的庫。如果我試圖整合它,它說
/home/user/droid-work/TestBBar/app/build/intermediates/res/merged/debug/values-v23/values-v23.xml
Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(34) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Error:Execution failed for task ':app:processDebugResources'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/root/Android/Sdk/build-tools/22.0.1/aapt'' finished with non-zero exit value 1
這裏是我的build.gradle文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.testbbar"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.aurelhubert:ahbottomnavigation:1.3.3'
//or compile 'com.roughike:bottom-bar:1.4.0.1'
//or compile 'it.sephiroth.android.library.bottomnavigation:bottom-navigation:1.0.7'
}
您的編譯SDK版本必須與支持庫的主要版本匹配。由於您使用的是支持庫的版本23,因此需要根據Android SDK的版本23進行編譯。 或者,您可以通過切換到最新的支持庫v22繼續針對Android SDK的版本22進行編譯。 Courtsy:[這裏](http://stackoverflow.com/questions/32075498/error-retrieving-parent-for-item-no-resource-found-that-matches-the-given-name) – LvN