Skip to content

Instantly share code, notes, and snippets.

@410063005
Created December 7, 2018 10:02
Show Gist options
  • Save 410063005/4501131fa2abcc26cce1ef81b2026176 to your computer and use it in GitHub Desktop.
Save 410063005/4501131fa2abcc26cce1ef81b2026176 to your computer and use it in GitHub Desktop.
用于测试华为nova手机内存泄漏的demo
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.demo_glide">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:name=".MyApp"
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">
<activity android:name=".TestPrefActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.demo_glide"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
}
package com.example.demo_glide;
import android.app.Application;
import com.squareup.leakcanary.LeakCanary;
public class MyApp extends Application {
@Override
public void onCreate() {
super.onCreate();
if (LeakCanary.isInAnalyzerProcess(this)) {
return;
}
LeakCanary.install(this);
}
}
package com.example.demo_glide;
public class TestPrefActivity extends AppCompatActivity {
public static void start(Context context) {
Intent starter = new Intent(context, TestPrefActivity.class);
context.startActivity(starter);
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_pref);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment