gpt4 book ai didi

android - 在 Android 中实现 Material Design 时出错

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:51:03 25 4
gpt4 key购买 nike

我一直在阅读新 Material 设计网站,但我在实现它时遇到了问题。

我目前正在使用的应用程序是一个简单的测试应用程序,只有一个按钮和一些 TextView 。

在 gradle 文件中放置 implementation 'com.google.android.material:material:1.0.0-alpha1' 后出现问题。

这是我的 build.gradle(app) 文件

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.user.firebasemessagingtest"
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'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
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'

implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.2'
implementation 'com.google.firebase:firebase-ml-vision:15.0.0'
implementation 'com.google.android.material:material:1.0.0-alpha1'
}

apply plugin: 'com.google.gms.google-services'

我有 4 个错误,

error: resource android:attr/dialogCornerRadius not found.
error: resource android:attr/fontVariationSettings not found.
error: resource android:attr/ttcIndex not found.
error: failed linking references.

我已将 maven 包含在项目 gradle 文件中,如文档中所述。

最佳答案

试试这个

更改compileSdkVersion和支持库版本

compileSdkVersion  'android-P'
Support Libraries to '28.0.0-alpha1'

和使用

 api 'com.android.support:design:28.0.0-alpha1'

编辑

Update your SDK Platform update - Android P Preview (latest)

and also make targetSdkVersion 'P'

Clean-Re_Build-Run你的项目

编辑2

apply plugin: 'com.android.application'

android {

compileSdkVersion 'android-P'

defaultConfig {
applicationId "com.example.nilesh.testapp"
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'
}
}

defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:support-v4:28.0.0-alpha1'
compile 'com.android.support:design:28.0.0-alpha1'
compile 'com.android.support:cardview-v7:28.0.0-alpha1'

implementation 'com.android.support.constraint:constraint-layout:1.1.0'

testImplementation 'junit:junit:4.12'

implementation 'com.google.android.material:material:1.0.0-alpha1'


implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.2'
implementation 'com.google.firebase:firebase-ml-vision:15.0.0'

androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
repositories {
mavenCentral()
}

希望对你有帮助

关于android - 在 Android 中实现 Material Design 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50330591/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com