CoderAlee / PaintedSkin

一款解决Android App 换肤框架,极低的侵入性与学习成本。
Apache License 2.0
166 stars 23 forks source link

请问一下 #23

Closed ylmyg closed 2 years ago

ylmyg commented 2 years ago

我按照文档说明加上依赖,为什么总是提示失败 No cached version of com.github.CoderAlee:AopPlugin-Compiler:3.4.2 available for offline mode. 我的依赖是这样的 maven { url "https://jitpack.io" } // 必须添加 implementation 'com.github.CoderAlee:Reflex:1.2.0' // 核心库 implementation 'com.github.CoderAlee.PaintedSkin:painted-skin:TAG' implementation 'com.github.CoderAlee.PaintedSkin:standard-plugin:TAG' // StandardPlugin 与 AutoPlugin 只需添加一个 annotationProcessor 'com.github.CoderAlee.PaintedSkin:auto-plugin:TAG' implementation 'com.github.CoderAlee.PaintedSkin:auto-plugin:TAG

CoderAlee commented 2 years ago

allprojects{ repositories{ maven { url "https://jitpack.io/" } } }

ylmyg commented 2 years ago

已经都加上了。我也觉得很奇怪。

ylmyg commented 2 years ago

可以加我QQ85446450么? 可以帮忙解决一下么?

CoderAlee commented 2 years ago

添加'com.github.CoderAlee.PaintedSkin:standard-plugin:TAG' 而不是 'com.github.CoderAlee.PaintedSkin:auto-plugin:TAG'试一下呢?如果还不可以,建议下载Demo在本地运行试一下

ylmyg commented 2 years ago

demo 是没有问题的 移植到自己项目里面就出现了 目前还不知道怎么去解决 我再看一下

ylmyg commented 2 years ago

Could not GET 'https://jitpack.io/com/github/CoderAlee/AopPlugin-Compiler/3.4.2/AopPlugin-Compiler-3.4.2.pom'. Received status code 401 from server: Unauthorized 我感觉是不是没有依赖了

CoderAlee commented 2 years ago

建议先使用standard-plugin

CoderAlee commented 2 years ago

目前auto-plugin 对kotlin的支持有问题

ylmyg commented 2 years ago

是这样么? implementation 'com.github.CoderAlee:Reflex:1.2.0' // 核心库 implementation 'com.github.CoderAlee.PaintedSkin:painted-skin:TAG' implementation 'com.github.CoderAlee.PaintedSkin:standard-plugin:TAG

CoderAlee commented 2 years ago

是的,如果项目中的Constraintlayout也需要换肤需要再添加上com.github.CoderAlee.PaintedSkin:constraintlayout-compat:3.4.2

ylmyg commented 2 years ago

这样就可以了,但是在调用ThemeSkinService.getInstance().switchThemeSkin(mTheme);//换肤 ,就会报错 java.lang.NullPointerException: Attempt to invoke interface method 'int org.alee.component.skin.service.IOptionFactory.defaultTheme()' on a null object reference at org.alee.component.skin.service.DefaultService.switchThemeSkin(DefaultService.java:118) at org.alee.component.skin.service.ThemeSkinService.switchThemeSkin(ThemeSkinService.java:91) at com.yxg.tcp.SendTcpActivity.onBindClick(SendTcpActivity.java:1307) at com.yxg.tcp.SendTcpActivity_ViewBinding$47.doClick(SendTcpActivity_ViewBinding.java:554) at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:18) at android.view.View.performClick(View.java:7704) at android.view.View.performClickInternal(View.java:7677) at android.view.View.access$3600(View.java:850) at android.view.View$PerformClick.run(View.java:29120) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:236) at android.app.ActivityThread.main(ActivityThread.java:8087) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:620) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011) 按理说ThemeSkinService也不需要初始化的呀?

CoderAlee commented 2 years ago

需要调用 WindowManager.getInstance().init(this,new OptionFactory()); 进行初始化

ylmyg commented 2 years ago

终于弄清楚了,原来demo里面用的是@skin,所以不需要进行初始化。