Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问支持dataBinding吗?用了 databinding的 module 合并成功之后 ,运行报错! #25

Closed
keke521 opened this issue Jul 11, 2019 · 6 comments
Labels
enhancement New feature or request

Comments

@keke521
Copy link

keke521 commented Jul 11, 2019

gradle 3.4.1
com.kezong:fat-aar:1.1.7

@kezong
Copy link
Owner

kezong commented Jul 11, 2019

dataBinding没有额外适配过,可以提供下更详细的错误信息。

@keke521
Copy link
Author

keke521 commented Jul 11, 2019

image

2019-07-11 18:03:46.613 16671-16671/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.keke.testfat_aar, PID: 16671
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.keke.testfat_aar/com.keke.lib1.example.Lib1Activity}: java.lang.NullPointerException: Attempt to read from field 'android.widget.TextView com.keke.lib1.databinding.ActivityLib1Binding.text' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2747)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2808)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6360)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
Caused by: java.lang.NullPointerException: Attempt to read from field 'android.widget.TextView com.keke.lib1.databinding.ActivityLib1Binding.text' on a null object reference
at com.keke.lib1.example.Lib1Activity.onCreate(Lib1Activity.java:18)
at android.app.Activity.performCreate(Activity.java:6863)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2700)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2808) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:163) 
at android.app.ActivityThread.main(ActivityThread.java:6360) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770) 

就是会报 空指针 binding 为空

@keke521
Copy link
Author

keke521 commented Jul 11, 2019

项目是 mvvm架构, 布局都是databinding,作者如果能适配,简直太感谢了

@kezong
Copy link
Owner

kezong commented Jul 11, 2019

晚上抽时间看了一下,因为插件资源合并的方案和dataBinding的实现有冲突,现在只支持在主module中使用dataBinding,也就是apply plugin: fat-aar的那一个module。
如果要支持在子module中支持dataBinding,比较困难,短时间内无法实现。

@kezong kezong added the enhancement New feature or request label Jul 11, 2019
@keke521
Copy link
Author

keke521 commented Jul 12, 2019

咨询下,这个databinding支持,有计划做吗😊

@kezong
Copy link
Owner

kezong commented Jul 12, 2019

@keke521 暂时没有计划。
你也可以看看有没有其他的解决方案,如果有什么好的解决方案可以同步给我。
同时你可以基于我的源码来实现databinding合并的能力,欢迎pull request.

@kezong kezong closed this as completed Aug 10, 2019
kezong added a commit that referenced this issue Sep 10, 2020
puboe added a commit to puboe/fat-aar-android that referenced this issue Sep 10, 2020
…mental-build

* 'master' of github.com:kezong/fat-aar-android:
  support merge data-binding files kezong#25 kezong#67
  Refactor duplicated code
  Avoid creation of preBuild tasks
  Avoid generateResources tasks creation
  Migrate sync task
  Migrate more tasks
  Migrate more tasks
  migrate more R related tasks
  Migrate R file task
  migrate mergeManifest tasks
  Migrate mergeJar tasks
  Migrate mergeClasses tasks to config avoidance API
  Fix some warnings

# Conflicts:
#	source/src/main/groovy/com/kezong/fataar/RProcessor.groovy
#	source/src/main/groovy/com/kezong/fataar/VariantProcessor.groovy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants