![](/img/trans.png)
[英]Adding buildFeatures { viewBinding true } results in "Cannot find a setter for <... android:visibility> that accepts parameter type 'int'
[英]Android Resourcse linking Failed while using : buildFeatures {viewBinding = true}
今天入手一個android工作室后,遇到了一個奇怪的問題。 它在說
DSL 元素 'android.viewBinding.enabled' 已過時,已替換為 'android.buildFeatures.viewBinding'。
搜索了一下后我發現我必須使用
buildFeatures {viewBinding = true}
反而。 所以,我用上面的替換了 viewBinding{enabled=true} 。 在那之后,真正的問題開始了。 AAPT 無法再檢測到我的可繪制對象。 這是我的構建腳本:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
和 build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.techtrixbd.RestaurantApp"
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildFeatures {viewBinding = true}
}
我不知道發生了什么事了。 任何建議都會有很大幫助。
我已經解決了這個問題。 我不得不將我的資源移動到 drawable-v24 文件夾。 而已。 但是,不要因為昨天一切正常而需要它。 也許更新與它有關。 我會尋找原因,如果我想出一些東西,我會發布。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.