使用bottomnavigationbar时巨多的坑

来源:互联网 发布:上网过滤软件 编辑:程序博客网 时间:2024/05/05 08:59
报错1:
Error:org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
注意这里的Android plugin version一定要是自己的版本,还有gradle version。当然也可以gradle配置文件里配置,当然可能没有可视化配置靠谱:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}


报错2:找不到资源V24 字符串varlue资源(对于在values-v24这类针对不同android target加载的values下找不到资源的问题,原因:找不到这个target下的资源。


调整以下关键版本:

android {

compileSdkVersion 24
buildToolsVersion '25.0.0'

defaultConfig {
applicationId "com.example.wangchang.testbottomnavigationbar"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

}

dependencies {

    compile fileTree(include: ['*.jar'], dir:'libs')

    testCompile 'junit:junit:4.12'

    compile'com.ashokvarma.android:bottom-navigation-bar:1.4.1'

    compile'com.android.support:appcompat-v7:24.0.3'

    compile'com.android.support:support-v4:24.0.3'

}





0 0
原创粉丝点击