AndroidX FrameLayout layout_heightPercent 属性未找到错误

AndroidX FrameLayout layout_heightPercent attribute not found error

尝试将我的 Android 项目从 API 25 升级到 AndroidX ,我在布局

中使用以下内容
<FrameLayout
        android:id="@+id/frame0"
        app:layout_heightPercent="10%"
        android:layout_marginTop="50dp"
        android:layout_height="wrap_content"
        android:layout_width="match_parent">

    <com.google.android.gms.ads.AdView
        android:id="@+id/adViewFirstPage1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="@string/banner_ad_1"
        android:layout_gravity="center"
        />

这是 AndroidX 的升级 gradle 文件 - 摘自 GitHub Google 示例

 implementation 'androidx.appcompat:appcompat:1.1.0'
 implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.firebase:firebase-core:17.2.1'
    implementation 'com.google.firebase:firebase-iid:20.0.2'
    implementation 'com.google.firebase:firebase-messaging:20.1.0'
    implementation 'android.arch.work:work-runtime:1.0.1'

现在我收到类似这样的错误 layout_heightPercent 在 FrameLayout 中找不到错误 AAPT:错误:在 AdMob 横幅中找不到属性 adUnitId

根据 Documentation,我找不到合适的库。一点帮助将非常有用。

以下为应用gradle文件内容

apply plugin: 'com.android.application'

android {
    compileSdkVersion 30
    defaultConfig {
        applicationId "com.myproject"
        minSdkVersion 16
        targetSdkVersion 30
        versionCode 5
        versionName "1.0"
        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    android {
        useLibrary 'org.apache.http.legacy'
    }
}
repositories {
    maven { url "https://jitpack.io" }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    implementation 'com.android.support:multidex:1.0.3'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.percentlayout:percentlayout:1.0.0'
    implementation 'com.github.PhilJay:MPAndroidChart:v2.1.6'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

    implementation 'com.google.android.gms:play-services-ads:19.2.0'
    implementation 'com.google.firebase:firebase-iid:20.2.3'
    implementation 'com.google.firebase:firebase-messaging:20.2.3'
    // For an optimal experience using FCM, add the Firebase SDK
    // for Google Analytics. This is recommended, but not required.
    implementation 'com.google.firebase:firebase-analytics:17.4.4'

    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    testImplementation 'junit:junit:4.12'
}

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

以下是项目gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
        classpath 'com.google.gms:google-services:4.3.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

更新后我们需要重构项目。有时我们需要相应地更改项目中的导入语句。