Skip to content

Commit

Permalink
LogUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
SiberiaDante committed Aug 7, 2017
1 parent fc8143b commit 00d7ad8
Show file tree
Hide file tree
Showing 54 changed files with 1,281 additions and 227 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
allprojects {
repositories {
...
aven { url 'https://jitpack.io' }
maven { url 'https://jitpack.io' }
}
}
```
Expand Down
26 changes: 26 additions & 0 deletions collection/Daily_Notes/测试常用方法.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## 利用AndroidStudio测试内存泄露
*
## 利用Monkey自动化测试
* 配置adb环境变量
* adb shell monkey [options]
* adb shell monkey -p package_name -v 100

## 利用Monkey自动化测试忽略crash等打印log日志
* 在PC上执行 运行—>CMD,在弹出的命令窗口中,输入adb devices,检查设备是否连接
* 在弹出的命令窗口中,输入adb shell,进入Linux Shell
* 执行以下命令
```
monkey -p com.shuinsen.zhiri --ignore-crashes --ignore-timeouts --ignore-native-crashes --pct-touch 30 -s 1 -v -v --throttle 200 100000 2>/sdcard/error.txt 1>/sdcard/info.txt
```
* -p com.lenovo.ideafriend只仅针对特定包名进行测试
* --ignore-crashes忽略应用程序崩溃(Force & Close错误),继续发送执行事件,直到事件数执行完成
* --ignore-timeouts忽略应用程序发生ANR(Application No Responding)错误时,直到事件数执行完成
* --ignore-native-crashes忽略本地应用程序发生奔溃,直到事件数执行完成
* --pct-touch 30调整触摸事件为30%。即整个事件过程中触摸事件占30%
* -s 1伪随机数生成器seed值。Seed值为1。相同的seed值再次执行monkey,将产生相同的事件序列。
* -v -v日志级别为Leve1 1。将提供较为详细的日志,包括每个发送到Activity的事件信息
* --throttle 200事件之间延时200毫秒。可以控制monkey的执行速度,如果不指定该选项,monkey事件间将不会延时。
* 100000执行事件数为10万次
* 2>/sdcard/error.txt Leve1 2日志保存到sdcard上的error.txt中
* 1>/sdcard/info.txt Leve1 1日志保存到sdcard上的info.txt中
8 changes: 8 additions & 0 deletions collection/MyInformation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

* EventBus
* ButterKnife
* Retrofit
* RXJava2
* RxJava2+Retrofit2
* 项目整体架构设计

3 changes: 3 additions & 0 deletions collection/NeedStudy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* 混淆
* 热修复
* RXJava2
6 changes: 6 additions & 0 deletions collection/其他技术、博客、框架等收集.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[EventBus的使用详解]

[EventBus的使用详解]:http://blog.csdn.net/harvic880925/article/details/40660137
[Android如何做一个崩溃率少于千分之三噶应用app--章节列表]

[Android如何做一个崩溃率少于千分之三噶应用app--章节列表]:http://www.jianshu.com/p/94a05b996d78
1 change: 1 addition & 0 deletions customapp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
48 changes: 48 additions & 0 deletions customapp/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"

defaultConfig {
applicationId "com.siberiadante.custom"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
testCompile 'junit:junit:4.12'
compile project(':siberiadante')
//RXJava
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'io.reactivex.rxjava2:rxjava:2.1.0'
//RxJava2 Adapter
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
//okhttp
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
//网络请求
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
//butterKnife
compile 'com.jakewharton:butterknife:8.7.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
//EventBus
compile 'org.greenrobot:eventbus:3.0.0'
}
17 changes: 17 additions & 0 deletions customapp/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\shuinsen05\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.siberiadante.custom;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.siberiadante.custom", appContext.getPackageName());
}
}
21 changes: 21 additions & 0 deletions customapp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.siberiadante.custom">

<application
android:name=".ui.MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ui.activity.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
12 changes: 12 additions & 0 deletions customapp/src/main/java/com/siberiadante/custom/bean/UserInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.siberiadante.custom.bean;

/**
* @Created SiberiaDante
* @Describe:
* @Time: 2017/8/7
* @Email: 994537867@qq.com
* @GitHub: https://github.com/SiberiaDante
*/

public class UserInfo {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.siberiadante.custom.bean.base;

/**
* @Created SiberiaDante
* @Describe:
* @Time: 2017/8/7
* @Email: 994537867@qq.com
* @GitHub: https://github.com/SiberiaDante
*/

public class WrapResult {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.siberiadante.custom.constant;

/**
* @Created SiberiaDante
* @Describe:
* @Time: 2017/8/7
* @Email: 994537867@qq.com
* @GitHub: https://github.com/SiberiaDante
*/

public class Constants {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.siberiadante.custom.constant;

/**
* @Created SiberiaDante
* @Describe:
* @Time: 2017/8/7
* @Email: 994537867@qq.com
* @GitHub: https://github.com/SiberiaDante
*/

public class RequestCode {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.siberiadante.custom.constant;

/**
* @Created SiberiaDante
* @Describe:
* @Time: 2017/8/7
* @Email: 994537867@qq.com
* @GitHub: https://github.com/SiberiaDante
*/

public class ResultCode {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.siberiadante.custom.http;

/**
* @Created SiberiaDante
* @Describe:
* @Time: 2017/8/7
* @Email: 994537867@qq.com
* @GitHub: https://github.com/SiberiaDante
*/

public class RetrofitManager {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.siberiadante.custom.ui;

import android.app.Application;

import com.siberiadante.SiberiaDanteLib;

/**
* @Created SiberiaDante
* @Describe: 这是一个通用的APP框架的搭建,开发中可以直接拿来使用
* @Time: 2017/8/7
* @Email: 994537867@qq.com
* @GitHub: https://github.com/SiberiaDante
*/

public class MyApplication extends Application {
private static MyApplication mInstance;

public static MyApplication getInstance() {
return mInstance;
}

@Override
public void onCreate() {
super.onCreate();
mInstance = this;
initSiberiaDante();
}

private void initSiberiaDante() {
SiberiaDanteLib.initLib(mInstance);
SiberiaDanteLib.setDebug(true);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.siberiadante.custom.ui.activity;

import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
* @Created SiberiaDante
* @Describe:
* @Time: 2017/8/7
* @Email: 994537867@qq.com
* @GitHub: https://github.com/SiberiaDante
*/

public abstract class BaseActivity extends AppCompatActivity {
public static final String TAG = BaseActivity.class.getSimpleName();

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
beforeSetContentView();
setContentView(setLayoutId());
ButterKnife.bind(this);
initView(savedInstanceState);
initData();
}

protected abstract void beforeSetContentView();

protected abstract int setLayoutId();

protected abstract void initView(Bundle savedInstanceState);

protected abstract void initData();

@Override
protected void onResume() {
super.onResume();

}

@Override
protected void onPause() {
super.onPause();
}

@Override
protected void onDestroy() {
super.onDestroy();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.siberiadante.custom.ui.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.siberiadante.custom.R;
import com.siberiadante.util.LogUtil;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.siberiadante.custom.ui.fragment;

/**
* @Created SiberiaDante
* @Describe:
* @Time: 2017/8/7
* @Email: 994537867@qq.com
* @GitHub: https://github.com/SiberiaDante
*/

public class BaseFragment {
}
13 changes: 13 additions & 0 deletions customapp/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main"
android:layout_width="match_parent" android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.siberiadante.custom.ui.activity.MainActivity">

<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Hello World!" />
</RelativeLayout>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions customapp/src/main/res/values-w820dp/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
Loading

0 comments on commit 00d7ad8

Please sign in to comment.