我一直在阅读新的材料设计网站,但我在实施它时遇到了问题。
我目前正在使用的应用程序是一个简单的测试应用程序,只有一个按钮和一些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
更多推荐
发布评论