Error:(19) No resource identifier found for attribute 'appComponentFactory' in package 'android' when trying to install ADMOB
Error:(19) No resource identifier found for attribute 'appComponentFactory' in package 'android' when trying to install ADMOB
我正在尝试将 Admob 添加到我的应用程序中。所以我已经在 Admob 上注册了我的帐户。我计划在没有 Firebase 的情况下使用它(但如果需要我可以这样做)。所以我跟着这个:
https://developers.google.com/admob/android/quick-start
我试图将其添加到 app.gradle 中:
compile 'com.google.android.gms:play-services-ads:18.3.0'
而且它不起作用。这是 app.gradle :
apply plugin: 'com.android.application'
android {
configurations.all {
resolutionStrategy.force 'junit:junit:4.12'
}
compileSdkVersion 27
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.xxx"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
repositories {
mavenCentral()
jcenter()
maven {
url "https://jitpack.io"
}
}
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.parse:parse-android:1.14.1'
compile 'com.github.parse-community.Parse-SDK-Android:parse:1.18.5'
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.0'
compile 'org.testng:testng:6.10'
compile 'com.github.PhilJay:MPAndroidChart:v3.1.0'
compile 'com.parse.bolts:bolts-tasks:1.3.0'
compile 'com.jjoe64:graphview:4.2.2'
compile 'com.android.support:cardview-v7:27.0.0'
compile 'javax.mail:javax.mail-api:1.6.0'
compile 'com.sun.mail:android-mail:1.6.0'
compile 'com.sun.mail:android-activation:1.6.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.android.support:design:27.1.1'
compile 'com.google.android.gms:play-services-ads:18.3.0'
//testCompile 'org.testng:testng:6.10'
compile files('C:/Users/xxx/AndroidStudioProjects/xxx/libs/activation.jar')
compile files('C:/Users/xxx/AndroidStudioProjects/xxx/libs/additionnal.jar')
compile files('C:/Users/xxx/AndroidStudioProjects/Bxx/libs/mail.jar')
compile 'com.google.android.gms:play-services-appindexing:9.0.0'
}
这是项目 gradle :
buildscript {
repositories {
//mavenCentral()
jcenter()
}
dependencies {
//compile "com.github.parse-community.Parse-SDK-Android:parse:JitPack.1.19.0"
classpath 'com.android.tools.build:gradle:2.2.1'
classpath 'com.google.gms:google-services:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
当我尝试编译时,错误立即将我发送到清单:
Error:(19) No resource identifier found for attribute 'appComponentFactory' in package 'android'
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
那些在清单中是红色的,但不仅如此:
android:allowBackup="true"
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
android:supportsRtl="true"
我尝试更改 google 服务的版本、应用索引的版本、添加的版本。我浏览了很多帖子,但似乎没有任何效果。要么是SDK版本不一样,我想降级到26但是android告诉我目录里找不到26
有人可以帮我吗?
谢谢
通过安装 firebase 并调整版本解决。
我正在尝试将 Admob 添加到我的应用程序中。所以我已经在 Admob 上注册了我的帐户。我计划在没有 Firebase 的情况下使用它(但如果需要我可以这样做)。所以我跟着这个:
https://developers.google.com/admob/android/quick-start
我试图将其添加到 app.gradle 中:
compile 'com.google.android.gms:play-services-ads:18.3.0'
而且它不起作用。这是 app.gradle :
apply plugin: 'com.android.application'
android {
configurations.all {
resolutionStrategy.force 'junit:junit:4.12'
}
compileSdkVersion 27
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.xxx"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
repositories {
mavenCentral()
jcenter()
maven {
url "https://jitpack.io"
}
}
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.parse:parse-android:1.14.1'
compile 'com.github.parse-community.Parse-SDK-Android:parse:1.18.5'
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.0'
compile 'org.testng:testng:6.10'
compile 'com.github.PhilJay:MPAndroidChart:v3.1.0'
compile 'com.parse.bolts:bolts-tasks:1.3.0'
compile 'com.jjoe64:graphview:4.2.2'
compile 'com.android.support:cardview-v7:27.0.0'
compile 'javax.mail:javax.mail-api:1.6.0'
compile 'com.sun.mail:android-mail:1.6.0'
compile 'com.sun.mail:android-activation:1.6.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.android.support:design:27.1.1'
compile 'com.google.android.gms:play-services-ads:18.3.0'
//testCompile 'org.testng:testng:6.10'
compile files('C:/Users/xxx/AndroidStudioProjects/xxx/libs/activation.jar')
compile files('C:/Users/xxx/AndroidStudioProjects/xxx/libs/additionnal.jar')
compile files('C:/Users/xxx/AndroidStudioProjects/Bxx/libs/mail.jar')
compile 'com.google.android.gms:play-services-appindexing:9.0.0'
}
这是项目 gradle :
buildscript {
repositories {
//mavenCentral()
jcenter()
}
dependencies {
//compile "com.github.parse-community.Parse-SDK-Android:parse:JitPack.1.19.0"
classpath 'com.android.tools.build:gradle:2.2.1'
classpath 'com.google.gms:google-services:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
当我尝试编译时,错误立即将我发送到清单:
Error:(19) No resource identifier found for attribute 'appComponentFactory' in package 'android' Error:Execution failed for task ':app:processDebugResources'. com.android.ide.common.process.ProcessException: Failed to execute aapt
那些在清单中是红色的,但不仅如此:
android:allowBackup="true"
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
android:supportsRtl="true"
我尝试更改 google 服务的版本、应用索引的版本、添加的版本。我浏览了很多帖子,但似乎没有任何效果。要么是SDK版本不一样,我想降级到26但是android告诉我目录里找不到26
有人可以帮我吗?
谢谢
通过安装 firebase 并调整版本解决。