Program type already present: android.support.v4.app.backstackrecord$Op

默认格式下生成project,编译出现
Program type already present: android.support.v4.app.backstackrecord$Op

//TODO other...
compileSdkVersion 28
    defaultConfig {
        applicationId "com.changan.facein"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "v1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

//TODO other...

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:design:28.0.0-alpha3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

后来去查阅Google官网和论坛,发现只要把API等级从28改成27以下就可以完美解决。代码如下

//TODO other...
 compileSdkVersion 27
    defaultConfig {
        applicationId "com.changan.facein"
        minSdkVersion 19
        targetSdkVersion 27
        versionCode 1
        versionName "v1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

//TODO other...

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:design:27.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

作为一个作死的程序员,一定要搞懂为嘛会出现这个情况。然后再查阅一批资料和跟大神不断交流中得出,

androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
这两兄弟最多支持到API27,到28跑不过人家了,然后这里就得出另一个解决方案,把这两兄弟的版本提升也是可以的。然而Maven大佬告诉我,他还没有最新的,好吧,楼上的方案还是暂行可以的


2326194-9508c8e6a88831a1.png
MAVEN runner
2326194-e2314f5941aa0d9b.png
MAVEN espresso-core
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值