Migration 找不到AndroidX FrameLayout\u heightPercent属性错误

Migration 找不到AndroidX FrameLayout\u heightPercent属性错误,migration,android-support-library,androidx,Migration,Android Support Library,Androidx,尝试将我的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="m

尝试将我的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"
        />
现在我发现了一些错误,比如 在FrameLayout中找不到布局\高度百分比错误 AAPT:错误:在AdMob横幅中未找到属性adUnitId


据我所知,我找不到合适的图书馆。一点帮助会非常有用。

以下是app 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
}
更新后,我们需要重构项目。有时我们需要相应地更改项目中的导入语句

// 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
}