在Android中实现Material Design时出错(Error implementing Material Design in Android)

编程入门 行业动态 更新时间:2024-10-27 21:10:36
在Android中实现Material Design时出错(Error implementing Material Design in Android)

我一直在阅读新的材料设计网站,但我在实施它时遇到了问题。

我目前正在使用的应用程序是一个简单的测试应用程序,只有一个按钮和一些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文件中,如文档中所述。

I've been reading over the new material design website but I'm having an issue implementing it.

The application I'm currently working in is a simple test applications with nothing more than a button and some textviews.

The problem comes after placing implementation 'com.google.android.material:material:1.0.0-alpha1' in the gradle file.

heres my build.gradle(app) file

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'

I've got 4 errors,

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.

I have included the maven in the project gradle file like stated in the documentation.

最满意答案

尝试这个

更改compileSdkVersion和支持库版本

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

并使用

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

编辑

更新SDK平台更新 - Android P预览(最新)

并使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() }

希望这可以帮助

Try this

change compileSdkVersion and Support Libraries version

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

and use

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

EDIT

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

and also make targetSdkVersion 'P'

Than Clean-Re_Build-Run your project

EDIT 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() }

Hope this helps

更多推荐

本文发布于:2023-08-06 04:41:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1444636.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Material   Android   Design   implementing   Error

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!