Android studio 运用Chorme 调试过程以及代码 stetho 运用
来源:互联网 发布:java多线程set redis 编辑:程序博客网 时间:2024/05/20 11:22
Android studio 运用Chorme 调试过程以及代码
第一步:导入jar包:okhttp-3.9.0.jar
stetho-1.3.1.jar stetho-okhttp3-1.3.1.jar stetho-urlconnection-1.3.1.jar
第二步:然后在app的build.gradle中填入代码:
compile 'com.facebook.stetho:stetho:1.3.1' compile 'com.facebook.stetho:stetho-okhttp3:1.3.1' compile 'com.facebook.stetho:stetho-urlconnection:1.3.1'
第三步:AndroidManifest.xml中代码
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.example.mr.myapplication"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" tools:replace="android:name" android:name=".MyApplication"> <activity android:name=".login"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".MainActivity"></activity> <dependency> <groupid>com.facebook.stetho</groupid> <artifactid>stetho</artifactid> <version>1.3.1</version> </dependency> </application></manifest>
第四步:建立类MyApplication
package com.example.mr.myapplication;import android.app.Application;import com.facebook.stetho.Stetho;import com.facebook.stetho.okhttp3.StethoInterceptor;import okhttp3.OkHttpClient;public class MyApplication extends Application { public static OkHttpClient okHttpClient; public void onCreate() { super.onCreate(); // 一般使用默认初始化配置足够使用 Stetho.initializeWithDefaults(this); // 如果需要查看网络请求相关信息(以使用okhttp3为例) initOkHttp(); } private void initOkHttp() { okHttpClient = new OkHttpClient() .newBuilder() .addNetworkInterceptor(new StethoInterceptor()) // 这里添加一个拦截器即可 .build(); }}
成功界面:
在Google中输入Chrome://inspect 点击inspect查看成功界面;
阅读全文
0 0
- Android studio 运用Chorme 调试过程以及代码 stetho 运用
- Android studio 数据库的运用
- Android调试利器--Stetho
- Android调试工具Stetho
- Stetho - Android 调试神器
- android调试神器Stetho
- android调试神器Stetho
- Stetho调试Android应用
- Google Analytics进阶运用之调试代码
- Android调试工具_ Stetho
- Android必知必会-Stetho调试工具
- facebook stetho Android调试工具
- Android Studio熟悉Log日志的运用
- Git在Android Studio上的运用
- 运用插件直接Android studio打包jar
- Android Studio module + gradle的巧妙运用
- Android IPC通信以及AIDL技术运用
- android事件监听器以及bitmap的运用
- ubuntu下hadoop-1.2.1的安装配置
- 那就从今天开始吧
- 2.Python之分支和循环
- js 拷贝
- util.ZipOutputStream 压缩文件
- Android studio 运用Chorme 调试过程以及代码 stetho 运用
- 12. Static class 与non static class的区别。
- <Android进阶>Android性能提升(一)
- SpringBoot 配置 WebSocket
- C语言—操作符总结
- 安卓中如何把一张图片加工成圆形
- Total Commander(全能文件管理器)官方破解版
- Spring的设计理念和优点
- 欧拉筛及例题