Skip to content

Instantly share code, notes, and snippets.

@CodeK1988
Last active August 26, 2019 08:33
Show Gist options
  • Select an option

  • Save CodeK1988/4ebe6d1d4ed28478cd058f466807a00a to your computer and use it in GitHub Desktop.

Select an option

Save CodeK1988/4ebe6d1d4ed28478cd058f466807a00a to your computer and use it in GitHub Desktop.
AndroidX迁移遇到的问题以及解决
1.AndroidX migrate dependency / libraries
I solved this issue by deleting .idea folder and syncing project again.
https://stackoverflow.com/questions/52518935/androidx-migrate-dependency-libraries
2.After migrating to androidx: Didn't find class “androidx.constraintlayout.ConstraintLayout” on path: DexPathList
https://stackoverflow.com/questions/54757911/after-migrating-to-androidx-didnt-find-class-androidx-constraintlayout-constr
3.Databinding kotlin
删除 kapt "com.android.databinding:compiler:$gradlePluginVersion" 依赖
如果还报错在
android.useAndroidX=true
android.enableJetifier=true
后面追加
android.databinding.enableV2 = false
android.enableExperimentalFeatureDatabinding = true
4.AndroidX - Program type already present: androidx.annotation.BoolRes 这个问题要具体视情况而定
https://stackoverflow.com/questions/52533779/androidx-program-type-already-present-androidx-annotation-boolres
具体参考
https://developer.android.com/jetpack/androidx
2019/08/26 追记
今天另一个项目也想迁移一下 看到之前做过笔记 nice!
菜单栏中依次选择 Refactor > Migrate to AndroidX
仍然会有很多需要你确认才能更改地方
这时候右键项目 Replace in Path能省却很多力气
遇到问题:
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':app:debugAnnotationProcessorClasspath'.
> Failed to transform file 'dagger-compiler-2.7.jar' to match attributes {artifactType=processed-jar} using transform JetifyTransform
> Failed to transform '/Users/swplzj/.gradle/caches/modules-2/files-2.1/com.google.dagger/dagger-compiler/2.7/65aa7daec6dd64bf4f3208b268c38c6a4fb2b849/dagger-compiler-2.7.jar' using Jetifier. Reason: The type does not support '.' as package separator! Received 'java.lang.Object;Ljava.lang.Class'.. (Run with --stacktrace for more details.) To disable Jetifier, set android.enableJetifier=false in your gradle.properties file.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
升级 dagger 2.7到 2.24还是不行
https://github.com/google/dagger
原来问题出在 Carbon 0.15.3 -> 0.16.0
https://github.com/ZieIony/Carbon
=======================================
1.样式问题
Button AndroidX Setting Background Color on Button has NO Effect
thanks https://stackoverflow.com/questions/53519356/androidx-setting-background-color-on-button-has-no-effect
and
Replace in path <androidx.appcompat.widget.AppCompatButton instead of <Button
it is working!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment