为什么Android Studio在实施了'constraintlayout:2.0.0-beta1'

时间:2019-05-17 10:20:30

标签: java android

我正在尝试使用Android Motion布局,并为此实现了androidx.constraintlayout:constraintlayout:2.0.0-beta1

但是在构建期间出现此错误。

我已经尝试过降级到约束布局的Alph4版本

  

Android资源编译失败   E:\ Users \ avinash91625 \ StudioProjects \ StanBuzzAndroid \ app \ build \ intermediates \ incremental \ mergeFreemiumDebugResources \ merged.dir \ values \ values.xml:5753:错误:资源'attr / circleRadius'的重复值带有配置''。   E:\ Users \ avinash91625 \ StudioProjects \ StanBuzzAndroid \ app \ build \ intermediates \ incremental \ mergeFreemiumDebugResources \ merged.dir \ values \ values.xml:5753:错误:先前在此处定义的资源。   E:\ Users \ avinash91625 \ StudioProjects \ StanBuzzAndroid \ app \ build \ intermediates \ incremental \ mergeFreemiumDebugResources \ merged.dir \ values \ values.xml:错误:文件无法编译。

我的应用gradle文件-

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId 'com.stanbuzz.android'
        minSdkVersion 21
        targetSdkVersion 28
        versionName '1.17'
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        versionCode 17
        renderscriptTargetApi 25
        renderscriptSupportModeEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    freemium {
        dimension = 'release'
        minSdkVersion 21
        versionCode = 21
    }
    }
    flavorDimensions 'release'
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.mikhaellopez:circularimageview:3.2.0'
    implementation 'info.hoang8f:android-segmented:1.0.6'
    implementation 'com.android.volley:volley:1.1.1'
    implementation 'com.github.ybq:Android-SpinKit:1.2.0'
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-auth:17.0.0'
    implementation 'com.google.firebase:firebase-firestore:19.0.0'
    implementation 'com.google.firebase:firebase-inappmessaging-display:17.1.1'
    implementation 'com.google.firebase:firebase-storage:17.0.0'
    implementation 'com.google.firebase:firebase-perf:17.0.0'
    implementation 'com.firebaseui:firebase-ui-firestore:4.3.0'
    implementation 'com.firebaseui:firebase-ui-storage:4.3.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.scottyab:aescrypt:0.0.1'
    implementation 'com.budiyev.android:code-scanner:2.0.1'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.msg91.sendotp.library:library:3.1'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
    implementation 'com.google.firebase:firebase-dynamic-links:17.0.0'
    implementation 'com.google.firebase:firebase-messaging:18.0.0'
    implementation 'com.google.firebase:firebase-functions:17.0.0'
    implementation 'com.github.siyamed:android-shape-imageview:0.9.3@aar'
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'com.yarolegovich:discrete-scrollview:1.4.9'
    implementation 'com.algolia:algoliasearch-android:3.26.1'
    implementation 'com.google.android.gms:play-services-gcm:16.1.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.squareup.okhttp:okhttp:2.7.5'
    implementation 'io.smooch:core:5.16.2'
    implementation 'io.smooch:ui:5.16.2'
    implementation 'com.github.javiersantos:MaterialStyledDialogs:2.1'
    implementation 'com.razorpay:checkout:1.5.2'
    implementation 'com.github.takusemba:spotlight:1.8.0'
    implementation 'com.github.sujithkanna:smileyrating:1.6.8'
    implementation 'com.orhanobut:dialogplus:1.11@aar'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.ncorti:slidetoact:0.6.0'
    implementation 'com.github.canner:android-stepsview:1.2'
    implementation 'pl.bclogic:pulsator4droid:1.0.3'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta1'
     // Temporary fix begin
    implementation 'com.android.support:support-annotations:27.1.1'
    annotationProcessor 'com.android.support:support-annotations:27.1.1'
    androidTestImplementation 'androidx.test:rules:1.1.2-alpha01'
    // Temporary fix end
}
apply plugin: 'com.google.gms.google-services'

E:\ Users \ avinash91625 \ StudioProjects \ StanBuzzAndroid \ app \ build \ intermediates \ incremental \ mergeFreemiumDebugResources \ merged.dir \ values \ values.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="orange">#fffaaa00</color>
    <color name="primary">#03A9F4</color>
    <color name="white">#fff</color>
    <color name="yellow">#ffff981e</color>
    <declare-styleable name="StepsView"><attr format="integer" name="numOfSteps"/><attr format="integer" name="completePosition"/><attr format="reference" name="labels"/><attr format="reference" name="barColor"/><attr format="reference" name="progressColor"/><attr format="reference" name="labelColor"/><attr format="reference" name="progressTextColor"/><attr format="boolean" name="hideProgressText"/><attr format="float" name="labelSize"/><attr format="float" name="progressMargin"/><attr format="float" name="circleRadius"/><attr format="float" name="progressStrokeWidth"/></declare-styleable>
    <string name="app_name">StepsView</string>
</resources>

我认为该库正在引起此问题-new AndroidX support

2 个答案:

答案 0 :(得分:0)

@Avinash,您是否清理并构建/使缓存项目无效?如果是这样,则此资源编译错误意味着有两个资源共享相同的属性。简单来说,您应该删除android.support.constraint.ConstraintLayout 在导入androidx.constraintlayout:constraintlayout:2.0.0-beta1之前。希望这个帮助

答案 1 :(得分:0)

您正在使用androidx库以及支持库

支持库

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-annotations:27.1.1'
annotationProcessor 'com.android.support:support-annotations:27.1.1'

删除不需要的支持库,并替换为相应的androidx库。

有关工件映射,请参见this