android开发针对api28引入最新butterknife新建项目的血案

android开发targetSdkVersion 28新建项目集成第三方的库例如butterknife:implementation ‘com.jakewharton:butterknife:10.1.0’,会遇到以下问题:

  1. Error: Invoke-customs are only supported starting with Android O (–min-api

在gradle.build中添加以下内容:

defaultConfig {
	compileOptions {
		sourceCompatibility JavaVersion.VERSION_1_8
  	    targetCompatibility JavaVersion.VERSION_1_8
	}
}
  1. Error:
    Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
    is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
    Suggestion: add ‘tools:replace=“android:appComponentFactory”’ to element at AndroidManifest.xml:15:2-101:16 to override.

    解决:

<application
        tools:replace="android:appComponentFactory"
        android:appComponentFactory="任意字符"
  1. Error: Program type already present: androidx.versionedparcelable.CustomVers

gradle.properties添加

android.useAndroidX=true
android.enableJetifier=true
  • ERROR: [TAG] Failed to resolve variable ‘ a n i m a l . s n i f f e r . v e r s i o n ′ E R R O R : [ T A G ] F a i l e d t o r e s o l v e v a r i a b l e ′ {animal.sniffer.version}&#x27; ERROR: [TAG] Failed to resolve variable &#x27; animal.sniffer.versionERROR:[TAG]Failedtoresolvevariable{junit.version}’

直接File->Invalidate Caches / restart,重启

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值