When I add the chip-group, The program does not work

Amin :

I got a problem in the Chip-Group section. This is the first time I use the Chip and Chip-Group, so I must download it. When I clicked the download button. They ask me: "This operation requires the library com.google.android.material:material:+, Would you like to add this now? " If I press the Yes button, Material is added correctly but with an error.

when I clicked the run button I got an error.

the error message is :

apply from: "$rootProject.projectDir/gradle.properties"
apply plugin: 'com.android.application'

android {
    compileSdkVersion versions.compileSdk
    buildToolsVersion "${versions.buildTools}"

defaultConfig {
    applicationId "com.twilio.video.quickstart"
    minSdkVersion versions.minSdk
    targetSdkVersion versions.targetSdk
    versionCode 1
    versionName "1.0"

    buildConfigField("String",
            "TWILIO_ACCESS_TOKEN",
            "\"${getSecretProperty("TWILIO_ACCESS_TOKEN", "TWILIO_ACCESS_TOKEN")}\"")
    buildConfigField("String",
            "TWILIO_ACCESS_TOKEN_SERVER",
            "\"${getSecretProperty("TWILIO_ACCESS_TOKEN_SERVER", "https://secure.advcare.info/mobapp/v1.0/adv/")}\"")
    buildConfigField("boolean",
            "USE_TOKEN_SERVER",
            "${getSecretProperty("USE_TOKEN_SERVER", false)}")
}

compileOptions {
    sourceCompatibility versions.java
    targetCompatibility versions.java
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

// Specify that we want to split up the APK based on ABI
splits {
    abi {
        // Enable ABI split
        enable true

        // Clear list of ABIs
        reset()

        // Specify each architecture currently supported by the Video SDK
        include "armeabi-v7a", "arm64-v8a", "x86", "x86_64"

        // Specify that we do not want an additional universal SDK
        universalApk false
    }
}
}

dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'

    implementation "com.twilio:video-android:${versions.videoAndroid}"
    implementation "com.koushikdutta.ion:ion:${versions.ion}"
    //noinspection GradleCompatible
    implementation "com.android.support:appcompat-v7:${versions.supportLibrary}"
    implementation "com.android.support:preference-v14:${versions.supportLibrary}"
    implementation "com.android.support:design:${versions.supportLibrary}"
    implementation "com.squareup.okhttp3:okhttp:3.10.0"
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.github.ceryle:SegmentedButton:v2.0.2'
    //This is added after press yes.
    implementation 'com.google.android.material:material:1.0.0'


}

If I remove the material from the code

('com.google.android.material:material:1.0.0')

My program works correctly.

help me

Sumit Shukla :
  • First migrate your project to androidX going to refactor -> Migrate to androidX.
  • Add dependency implementation 'com.google.android.material:material:1.0.0'
    or
    implementation 'com.google.android.material:material:1.1.0-alpha08'

Then use Chip-Group as:

<com.google.android.material.chip.ChipGroup
     android:id="@+id/reflow_group"
     android:layout_width="match_parent"
     android:layout_height="wrap_content">

     <com.google.android.material.chip.Chip
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="@string/txt_this" />
</com.google.android.material.chip.ChipGroup>

Explore more

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=162554&siteId=1