Android development targetSdkVersion 28 integrated third-party libraries in new projects such as butterknife: implementation ‘com. Jakewharton: butterknife: 10.1.0’, will encounter the following problems:

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

Add the following to gradle.build:

defaultConfig { compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }}Copy the code
  1. Error: Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com. Android. Support: support – compat: 28.0.0] AndroidManifest. XML: make haste – 91 is also present at [androidx. Core: the core: 1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: Add ‘tools: replace = “android: appComponentFactory” element to the at AndroidManifest. XML: “- 101:16 to override.

    Solution:

< application tools: replace = "android: appComponentFactory" android: appComponentFactory = "any character"Copy the code
  1. Error: Program type already present: androidx.versionedparcelable.CustomVers

Gradle. Add the properties

android.useAndroidX=true
android.enableJetifier=true
Copy the code
  • 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 o r: [T A G] F A I I I I I I I I I I I I I I ERROR: [TAG] Failed to resolve variable ‘ Animal. Sniffers. Version ‘ERROR: [TAG] Failedtoresolvevariable’ {junit. Version} ‘

Go to File->Invalidate Caches/restart to restart the Caches