关于生产环境使用Freeline的两个疑问
feelschaotic opened this issue · comments
意图:我希望Freeline不影响正式包的性能
疑问:
疑问1.
是否只需要在项目 build 中 classpath "com.antfortune.freeline:gradle:xxxx"
,就自动会在 release 包里加入一个空实现的库?无需自己再手动配置no-op依赖?apply freeline plugin 是否会影响性能?
疑问2.
配置 autoDependency 后启动崩溃。
我看到支持 DSL autoDependency来配置是否自动依赖 runtime,所以我做了如下操作:
freeline {
hack true
productFlavor 'myProductFlavor'
autoDependency false
}
同时在app
中配置依赖
debugCompile "com.antfortune.freeline:runtime:$freeline"
releaseCompile "com.antfortune.freeline:runtime-no-op:$freeline"
testCompile "com.antfortune.freeline:runtime-no-op:$freeline"
但加入后,项目启动崩溃
android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=null pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x40 color=0x00000000 vis=PRIVATE)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1768)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
盼解答,感谢!