真机调试问题汇总

1.魅族真机调试时,日志不打印。

解决办法:打开【设置】中的【开发者选项】,页面底部找到【性能优化】,打开【高级日志输出】,勾选【全部允许】即可。

PS:华为手机设置方式较为特殊,不是在【开发者选项】中,而是打开拨号界面的拨号盘,输入*#*#2846579#*#*,系统会自动打开【工程菜单】界面,依次打开【后台设置】 -> 【LOG设置】,勾选【AP日志】即可。

参考:http://yifeng.studio/2017/02/26/android-meizu-huawei-not-log/

 

2.9.0使用 org.apache.http.legacy 库崩溃

在AndroidManifest.xml,application节点里面包裹

<uses-library android:name="org.apache.http.legacy" android:required="false" />
崩溃日志:java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/impl/cookie/DateUtils

3.血泪教训,魅族手机做AIDL的时候,太坑了。客户端不能用setPackage()这种方法,要用setComponent()。否则无法启动远程服务。而且,目前是发现必须加startService(),但网上别的参考是不用的,只需要bindService就行了。目前没有发现原因。

private void bindService(){
        Intent intent = new Intent();
        intent.setAction("com.joe.action");
        //intent.setPackage("com.joe.testaidl");
        intent.setComponent(new ComponentName("com.joe.testaidl","com.joe.testaidl.AIDLService"));
        startService(intent);
        binded = bindService(intent,connection, Context.BIND_AUTO_CREATE);
    }

  



posted @ 2019-05-07 15:57  jdhdevelop  阅读(458)  评论(0编辑  收藏  举报