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

control == null #13

Closed
Deepblue1996 opened this issue Apr 23, 2018 · 25 comments
Closed

control == null #13

Deepblue1996 opened this issue Apr 23, 2018 · 25 comments

Comments

@Deepblue1996
Copy link

control == null
无法正常使用

@EspoirX
Copy link
Owner

EspoirX commented Apr 23, 2018

看看你是怎么使用的?

@Deepblue1996
Copy link
Author

按照步骤application初始化,
然后
SongInfo songInfo2 = new SongInfo();
songInfo2.setSongId("id"+musicStateBean.getLocation());
songInfo2.setSongUrl(musicStateBean.getSong().path);
MusicManager.get().playMusicByInfo(songInfo2);

@Deepblue1996
Copy link
Author

qq 20180423152351

@EspoirX
Copy link
Owner

EspoirX commented Apr 23, 2018

不会是服务没起来吧,你看看有没有:musiclibrary进程,因为是在 ServiceConnection 里面赋值的

@Deepblue1996
Copy link
Author

我看看

@EspoirX
Copy link
Owner

EspoirX commented Apr 23, 2018

你断点一下第143行,看看ServiceConnection里面有没有赋值

@Deepblue1996
Copy link
Author

qq 20180423153905
没有跑到

@EspoirX
Copy link
Owner

EspoirX commented Apr 23, 2018

这么神奇吗,你再断下137行,看看有没有bindService

@Deepblue1996
Copy link
Author

qq 20180423154217

@EspoirX
Copy link
Owner

EspoirX commented Apr 23, 2018

刚刚我在demo中试了一下,是没问题的。你这里很奇怪,它绑定了服务还不走 onServiceConnected 回调这么神奇

@Deepblue1996
Copy link
Author

qq 20180423154834
我刚刚自己写了个服务是可以绑定回调的,是不是要AndroidManifest注册?

@EspoirX
Copy link
Owner

EspoirX commented Apr 23, 2018

不需要自己注册,我里面都注册好了。
我觉得可以试试下面的做法:
第一个看看服务启动了没有,看看有没有musiclibrary进程。
第二个可以先clone代码,先用library的方式引用,方便调试问题所在
第三个,我是在NiceMusic这个demo里面测试的,没重现到问题,你也可以看看

@Deepblue1996
Copy link
Author

本地引用库,一样没回调,额(⊙﹏⊙)

@Deepblue1996
Copy link
Author

你的NiceMusic应该是用AndroidStudio3.0+开发的,我花了点功夫刚移植到AndroidStudio2.3,现在测试体体

@EspoirX
Copy link
Owner

EspoirX commented Apr 23, 2018

现在都用3.0了吧,我用3.0.1的

@Deepblue1996
Copy link
Author

用惯2.3.3,我个人不太喜欢3.0的调试器,还有一些项目都是2.3.3开发的,出问题麻烦,所以没用,不过我装了最新的as预览版

@Deepblue1996
Copy link
Author

你的项目的确可以回调的,奇怪

@EspoirX
Copy link
Owner

EspoirX commented Apr 23, 2018

不知道你是不是设置了什么其他东西影响到了……

@Deepblue1996
Copy link
Author

吖,用不了

@Deepblue1996
Copy link
Author

我刚刚开了一个新demo,也不可以,没有回调,你也试试创建一个新的demo,引用,然后application断init里面的回调

@EspoirX
Copy link
Owner

EspoirX commented Apr 23, 2018

我创建一个试试

@EspoirX
Copy link
Owner

EspoirX commented Apr 23, 2018

试了,没问题,你直接在你的主activity里面初始化,看看 control 还是不是null 试试
qq 20180423171939
你加我qq吧,方便一点

@Deepblue1996
Copy link
Author

qq1023509177

@Deepblue1996
Copy link
Author

implementation 'com.android.support:appcompat-v7:26.1.0'
27+版本抛null

@Deepblue1996
Copy link
Author

27+, 需要额外引用
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-media-compat:27.1.1'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants