添加 google admob 依赖项后我无法构建我的项目
I can not build my project after adding google admob dependencies
添加 google Admob 依赖项后无法构建我的 project.So 我迁移到 Androidx 然后我的片段中有一堆 errors.Especialy。
Android resource linking failed
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_btn_colored_borderless_text_material.xml:20: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_btn_colored_text_material.xml:20: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_tint_btn_checkable.xml:19: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_tint_default.xml:19: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_tint_edittext.xml:19: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_tint_seek_thumb.xml:19: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_tint_spinner.xml:19: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_tint_switch_track.xml:19: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_tint_switch_track.xml:20: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_tint_switch_track.xml:21: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\Desktop\StopSmokingNow\app\src\main\res\font\abril_fatface.xml:2: error: attribute fontProviderAuthority (aka com.samex.android.stopsmokingnow:fontProviderAuthority) not found.
C:\Users\DT User3\Desktop\StopSmokingNow\app\src\main\res\font\abril_fatface.xml:2: error: attribute fontProviderCerts (aka com.samex.android.stopsmokingnow:fontProviderCerts) not found.
C:\Users\DT User3\Desktop\StopSmokingNow\app\src\main\res\font\abril_fatface.xml:2: error: attribute fontProviderPackage (aka com.samex.android.stopsmokingnow:fontProviderPackage) not found.
C:\Users\DT User3\Desktop\StopSmokingNow\app\src\main\res\font\abril_fatface.xml:2: error: attribute fontProviderQuery (aka com.samex.android.stopsmokingnow:fontProviderQuery) not found.
C:\Users\DT User3\Desktop\StopSmokingNow\app\src\main\res\font\alex_brush.xml:2: error: attribute fontProviderAuthority (aka com.samex.android.stopsmokingnow:fontProviderAuthority) not found.
C:\Users\DT User3\Desktop\StopSmokingNow\app\src\main\res\font\alex_brush.xml:2: error: attribute fontProviderCerts (aka com.samex.android.stopsmokingnow:fontProviderCerts) not found.
这是我的 Gradle 文件,看起来一切正常,我 think.And 在 getActivity.getFragmentManager 的片段中有问题,@Nonnull 无法识别
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.samex.android.stopsmokingnow"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.daimajia.easing:library:2.0@aar'
implementation 'com.daimajia.androidanimations:library:2.3@aar'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.gms:play-services-ads:19.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
}
解决方法一:检查是否所有的依赖成功转化为androidx?如果不先做。
解决方案 2: 将所有 gradle 版本升级到最新版本。然后进行清理和重建。
解决方案 3: 转到文件 -> 使缓存无效并重新启动。
如果您仍然遇到同样的问题,请分享您的 gradle 文件。所以,我们可以观察并给出适当的解决方案。
过了这么久还是没有答案我做了 it.First 我最后下载了 gradle 然后更新了依赖项
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.samex.android.stopsmokingnow"
minSdkVersion 16
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.daimajia.easing:library:2.1@aar'
implementation 'com.daimajia.androidanimations:library:2.3@aar'
implementation "androidx.recyclerview:recyclerview:1.1.0"
// implementation 'androidx.browser:browser:1.2.0'
// implementation 'androidx.media:media:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
// implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.gms:play-services-ads:19.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
然后手动下载 gradle 并发布为该项目的默认设置,这样我就能够编译 build.Thanks 每个人都没有 ansering.Cheers!!!
添加 google Admob 依赖项后无法构建我的 project.So 我迁移到 Androidx 然后我的片段中有一堆 errors.Especialy。
Android resource linking failed
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_btn_colored_borderless_text_material.xml:20: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_btn_colored_text_material.xml:20: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_tint_btn_checkable.xml:19: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_tint_default.xml:19: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_tint_edittext.xml:19: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_tint_seek_thumb.xml:19: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_tint_spinner.xml:19: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_tint_switch_track.xml:19: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_tint_switch_track.xml:20: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\.gradle\caches\transforms-2\files-2.1\b4ff399857e82d00548bc792e5cf526d\res\color\abc_tint_switch_track.xml:21: error: attribute alpha (aka com.samex.android.stopsmokingnow:alpha) not found.
C:\Users\DT User3\Desktop\StopSmokingNow\app\src\main\res\font\abril_fatface.xml:2: error: attribute fontProviderAuthority (aka com.samex.android.stopsmokingnow:fontProviderAuthority) not found.
C:\Users\DT User3\Desktop\StopSmokingNow\app\src\main\res\font\abril_fatface.xml:2: error: attribute fontProviderCerts (aka com.samex.android.stopsmokingnow:fontProviderCerts) not found.
C:\Users\DT User3\Desktop\StopSmokingNow\app\src\main\res\font\abril_fatface.xml:2: error: attribute fontProviderPackage (aka com.samex.android.stopsmokingnow:fontProviderPackage) not found.
C:\Users\DT User3\Desktop\StopSmokingNow\app\src\main\res\font\abril_fatface.xml:2: error: attribute fontProviderQuery (aka com.samex.android.stopsmokingnow:fontProviderQuery) not found.
C:\Users\DT User3\Desktop\StopSmokingNow\app\src\main\res\font\alex_brush.xml:2: error: attribute fontProviderAuthority (aka com.samex.android.stopsmokingnow:fontProviderAuthority) not found.
C:\Users\DT User3\Desktop\StopSmokingNow\app\src\main\res\font\alex_brush.xml:2: error: attribute fontProviderCerts (aka com.samex.android.stopsmokingnow:fontProviderCerts) not found.
这是我的 Gradle 文件,看起来一切正常,我 think.And 在 getActivity.getFragmentManager 的片段中有问题,@Nonnull 无法识别
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.samex.android.stopsmokingnow"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.daimajia.easing:library:2.0@aar'
implementation 'com.daimajia.androidanimations:library:2.3@aar'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.gms:play-services-ads:19.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
}
解决方法一:检查是否所有的依赖成功转化为androidx?如果不先做。
解决方案 2: 将所有 gradle 版本升级到最新版本。然后进行清理和重建。
解决方案 3: 转到文件 -> 使缓存无效并重新启动。
如果您仍然遇到同样的问题,请分享您的 gradle 文件。所以,我们可以观察并给出适当的解决方案。
过了这么久还是没有答案我做了 it.First 我最后下载了 gradle 然后更新了依赖项
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.samex.android.stopsmokingnow"
minSdkVersion 16
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.daimajia.easing:library:2.1@aar'
implementation 'com.daimajia.androidanimations:library:2.3@aar'
implementation "androidx.recyclerview:recyclerview:1.1.0"
// implementation 'androidx.browser:browser:1.2.0'
// implementation 'androidx.media:media:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
// implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.gms:play-services-ads:19.0.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
然后手动下载 gradle 并发布为该项目的默认设置,这样我就能够编译 build.Thanks 每个人都没有 ansering.Cheers!!!