我无法添加新的Material Design库。
当我添加compile 'com.google.android.material:material:1.0.0-alpha1'
并同步项目时,我得到了这两个错误:
error: resource android:attr/fontVariationSettings not found.
error: resource android:attr/ttcindex not found.
我的build.gradle
:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "rockthesport.com.pruebasmaterial"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
compile 'com.google.android.material:material:1.0.0-alpha1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
有什么建议吗?
谢谢!
答案 0 :(得分:2)
要使用新的Material Components library public function index() {
$dbdata['table'] = 'categories';
$dbdata['select'] = array('id', 'parent', 'name');
$dbdata['where'] = array('type' => 'post');
$records = $this->ot->get_records($dbdata);
for ($i = 0; $i < sizeof($records); $i++) {
$records[$i]['category'] = $this->category($records, 0, $records[$i]);
}
}
function category($records, $parent = 0, $record = NULL) {
if ($record) {
$parent = '';
if ($record['parent']) {
$parent = $this->category($records, $record['parent']);
}
return $parent . $record['name'];
} else {
$super_parent = '';
$key = array_search($parent, array_column($records, 'id'));
if ($records[$key]['parent']) {
$super_parent = $this->category($records, $records[$key]['parent']);
}
$super_parent .= $records[$key]['name'] . ' / ';
return $super_parent;
}
}
,您必须使用
'com.google.android.material:material:1.0.0-alpha1'
答案 1 :(得分:0)
这是gradle文件的工作版本
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-P'
defaultConfig {
applicationId "info.manipal.aesher.infomuj"
minSdkVersion 24
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
api 'androidx.appcompat:appcompat:1.0.0-alpha1'
api 'com.google.android.material:material:1.0.0-alpha1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha2'
}