首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >'android.support.design.widget‘不能安全地重写。怎么解决这个问题?

'android.support.design.widget‘不能安全地重写。怎么解决这个问题?
EN

Stack Overflow用户
提问于 2022-09-07 09:42:51
回答 1查看 69关注 0票数 0

构建项目时,我得到了这个错误:-

给定的工件包含一个带有包引用'android.support.design.widget‘的字符串文本,无法安全地重写。需要手动更新使用反射(如注释处理器)的库,以添加对androidx的支持。

我也曾多次清洗项目。我尝试了很多解决方案,但对我来说都没有用.

我的gradle.properties :-

代码语言:javascript
运行
复制
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
android.enableJetifier=true

(我删除了gradle.properties文件的注释)

我的build.gradle(:app) :-

代码语言:javascript
运行
复制
plugins {
    id 'com.onesignal.androidsdk.onesignal-gradle-plugin'
    id 'com.android.application'
    // Other plugins here if pre-existing
}

android {
    dataBinding {
        enabled = true}
    compileSdk 32

    buildFeatures{
        viewBinding true
    }

    defaultConfig {
        applicationId "com.dccodes.chugli"
        minSdk 21
        targetSdk 31
        versionCode 5
        versionName '1.0'

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled true

            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    namespace 'com.dccodes.chugli'
    buildToolsVersion '33.0.0'
}

dependencies {
    implementation 'com.github.hani-momanii:SuperNova-Emoji:1.1'
    implementation 'com.android.tools.build:gradle:7.2.0'
    implementation 'androidx.appcompat:appcompat:1.5.0'
    implementation 'com.google.android.material:material:1.6.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
//    implementation 'com.android.support:appcompat-v7:28.0.0'
//    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'androidx.appcompat:appcompat:1.5.0'
//    implementation 'androidx.support:support-v4:28.0.0'
//    implementation 'com.android.support.constraint:constraint-layout:2.0.4'
    implementation 'org.jetbrains:annotations:23.0.0'
    implementation 'com.google.firebase:firebase-firestore:24.2.1'
    implementation 'androidx.emoji:emoji:1.1.0'
   
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    implementation 'com.google.firebase:firebase-auth:21.0.6'
    implementation 'com.google.firebase:firebase-database:20.0.5'
    implementation 'com.google.firebase:firebase-storage:20.0.1'
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation 'com.github.bumptech.glide:glide:4.13.2'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'
    implementation 'com.github.mukeshsolanki:android-otpview-pinview:2.1.2'

    implementation platform('com.google.firebase:firebase-bom:30.3.1')
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-auth'
    implementation 'com.google.firebase:firebase-database:20.0.5'
    implementation 'com.google.firebase:firebase-storage'
    implementation 'androidx.preference:preference:1.2.0'
    implementation 'com.google.firebase:firebase-messaging'
    implementation 'com.google.firebase:firebase-config'
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation 'com.github.bumptech.glide:glide:4.13.2'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'
    implementation 'com.github.pgreze:android-reactions:1.6'
    implementation 'com.devlomi:circularstatusview:1.0.1'
    implementation 'com.github.OMARIHAMZA:StoryView:1.0.2-alpha'
    implementation 'com.github.sharish:ShimmerRecyclerView:v1.3'

    implementation 'com.android.volley:volley:1.2.1'
    implementation 'com.onesignal:OneSignal:4.8.2'
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24'

}

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

我的build.gradle(Chugli) :-

代码语言:javascript
运行
复制
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        maven { url 'https://jitpack.io' }
        google()
        mavenCentral()
        gradlePluginPortal()
        jcenter()
    }
    dependencies {
        classpath 'com.github.hani-momanii:SuperNova-Emoji:1.1'
        classpath 'com.android.tools.build:gradle:7.2.2'
        classpath 'com.google.gms:google-services:4.3.10'
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url "https://jitpack.io" }
        jcenter()
    }
}

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

我不明白为什么我会犯这个错误..。,有人能帮我吗?

EN

回答 1

Stack Overflow用户

发布于 2022-09-08 09:15:07

要解决此错误,删除这一行 :-

代码语言:javascript
运行
复制
//implementation 'androidx.support:support-v4:28.0.0'

并且将这一行添加到您的中:

代码语言:javascript
运行
复制
implementation 'androidx.support:support-v4:28.0.0'
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73633274

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档