问题描述 | 分析原因 | 解决方案 | 源码: public class MainActivity extends AppCompatActivity { ? ? @Override ? ? protected void onCreate(Bundle savedInstanceState) { ? ? ? ? super.onCreate(savedInstanceState); ? ? ? ? ActivityMainBinding mainBinding = DataBindingUtil.setContentView(this, R.layout.activity_main); ? ?} } 报错: 不兼容的类型: 推论变量 T 具有不兼容的上限 ActivityMainBinding,ViewDataBinding。 | 在??implementation 'androidx.databinding:databinding-runtime:4.1.3'后面增加了: ? ? implementation 'androidx.databinding:databinding-adapters:4.1.3' ? ? implementation 'androidx.databinding:databinding-common:4.1.3' ? ? implementation 'androidx.databinding:databinding-compiler-common:4.1.3' ? ? annotationProcessor 'androidx.databinding:databinding-compiler:4.1.3' ? ? Caused by: android.databinding.tool.util.LoggedErrorException: failure, see logs for details. AndroidX Error: Both old and new data binding packages are available in dependencies. Make sure you've setup jettifier ?for any data binding dependencies and also set android.useAndroidx in your gradle.properties file. | |
duplicate entry: module-info.class set android.enableJetifier=false
Duplicate class error,Android support和Androidx库共存的问题_vamayoumo的博客-CSDN博客
android.useAndroidX=true//是否使用androidx?? ? android.enableJetifier=true//是否将引入的第三方库中的android.support强制转为androidx android.jetifier.blacklist=A.aar ?
butterknife从8.8.1升级到10.0.0
implementation "com.jakewharton:butterknife:10.0.0" annotationProcessor "com.jakewharton:butterknife-compiler:10.0.0" ?
Caused by: com.android.tools.build.jetifier.processor.transform.bytecode.AmbiguousStringJetifierException: The given artifact contains a string literal with a package reference 'android.support.design.widget' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx. ?
问题:The given artifact contains a string literal with a package reference 'andro_d u o l c-CSDN博客
AndroidX Error: Both old and new data binding packages are available in dependencies. Make sure you've setup jettifier ?for any data binding dependencies and also set android.useAndroidx in your gradle.properties file.
butterknife 遇上 AndroidX_轻狂书生YT的博客-CSDN博客
com.android.tools.build? ? ? ?'android.support.design.widget' that cannot be safely rewritten.
应该是dependencies里还有其他包,注释掉。 // ? ?implementation 'com.google.android.material:material:1.4.0'
最终注释掉?
// ? ?implementation project(':p02asmClick_plugin')
解决了。大意了,把transform插件的依赖去掉,本来就不应该加上这个依赖,它是插件,不是模块。
|