当我添加芯片组时,该程序不起作用

时间:2019-07-11 06:21:28

标签: java android android-studio android-chips

“芯片组”部分出现问题。 这是我第一次使用Chip and Chip-Group,因此必须下载它。 当我单击下载按钮时。他们问我:“此操作需要库com.google.android.material:material:+,是否要立即添加?” 如果按“是”按钮,则正确添加了材料,但出现了错误。

当我单击运行按钮时,出现错误。

错误消息是:

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'


}

如果我从代码中删除了材料

  

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

我的程序正常工作。

救救我

3 个答案:

答案 0 :(得分:1)

  • 首先将项目迁移到A B C D ------- 1 1 1 1 1 1 2 1 1 1 2 2 ,然后再迁移到androidX
  • 添加依赖项实现refactor -> Migrate to androidX'

    'com.google.android.material:material:1.0.0'implementation'

然后将Chip-Group用作:

com.google.android.material:material:1.1.0-alpha08

Explore more

答案 1 :(得分:0)

  

在模块classes.jar(androidx.core ....)和classes.jar(com.android.support ....)中找到重复的类(...)

尝试migrating your code to androidX,这应该可以解决问题。

答案 2 :(得分:-1)

我认为是正确的,但对我而言不起作用。当我在 Gradle.properties文件中放置“ android.useAndroidX = true android.enableJetifier = true” 时,出现错误:

错误:

无法获得类型为org.gradle.api.Project的项目':quickstart'的未知属性'android'。