🍼Debug Bottle is an Android runtime debug / develop tools written using kotlin language.

Overview
build:created version:maven-central

🇨🇳 中文 / 🇯🇵 日本語 / 🇬🇧 English

🍼 Debug Bottle

An Android debug / develop tools written using Kotlin language. All the features in Debug bottle are only available on debug build version with your app, it doesn't has an impact on release version.

Demo App is now available at Google Play:

Get it on Google Play

What can I do with Debug Bottle?

OkHttp Sniffer

Enable "Network Listener" at Settings, then you can see all network traffics what requested by your app.

Scalpel Viewer

Enable "3D View", then you can view your Activity. When interaction is enabled the following gestures are supported:

  • Single touch: Controls the rotation of the model.
  • Two finger vertical pinch: Adjust zoom.
  • Two finger horizontal pinch: Adjust layer spacing.

Shared Preferences editor

Preview and edit the Shared Preferences of app more simply.

Strict Mode

Enable or disable Android strict mode at runtime. StrictMode is a developer tool which detects things you might be doing by accident and brings them to your attention so you can fix them. StrictMode is most commonly used to catch accidental disk or network access on the application's main thread, where UI operations are received and animations take place. For more information, see Android Developers.

Crash Log

List all crash stacktrace logs.

Leak Canary

Leak Canary is fully imported. Leak Canary is a memory leak detection library for Android and Java. More about using Leak Canary by visiting Leak Canary wiki.

Block Canary

Detect UI blocks at runtime.

Development Entries

Launch any Activity with custom Intents, or Runnable you want.

How do I use it?

After installing Debug Bottle Demo app, you'll find there are two app icons appears to launcher. Click bottle icon to run Debug Bottle.

Setting up

1. Configure your Gradle project

Add snapshot of maven central repository to primary Gradle file:

allprojects {
    repositories {
        ...
        mavenCentral()
    }
}

Edit and add dependencies in your app module:

dependencies {
    debugCompile 'com.exyui.android:debug-bottle-runtime:1.1.1'

    // Use this in your Java project
    releaseCompile 'com.exyui.android:debug-bottle-noop-java:1.1.1'
    testCompile 'com.exyui.android:debug-bottle-noop-java:1.1.1'

    // Use this in your Kotlin project
    releaseCompile 'com.exyui.android:debug-bottle-noop-kotlin:1.1.1'
    testCompile 'com.exyui.android:debug-bottle-noop-kotlin:1.1.1'

    compile 'com.android.support:appcompat-v7:23.2.0+'
}

Specially, Debug Bottle not only support API 23+, but also 22. To support API 22, please add dependencies like this:

dependencies {
    debugCompile 'com.exyui.android:debug-bottle-runtime:1.0.6-support22'

    // Use this in your Java project
    releaseCompile 'com.exyui.android:debug-bottle-noop-java:1.0.6-support22'
    testCompile 'com.exyui.android:debug-bottle-noop-java:1.0.6-support22'

    // Use this in your Kotlin project
    releaseCompile 'com.exyui.android:debug-bottle-noop-kotlin:1.0.6-support22'
    testCompile 'com.exyui.android:debug-bottle-noop-kotlin:1.0.6-support22'

    compile 'com.android.support:appcompat-v7:22+'
}

To support API 23, add dependencies like this:

dependencies {
    debugCompile 'com.exyui.android:debug-bottle-runtime:1.0.6-support23'

    // Use this in your Java project
    releaseCompile 'com.exyui.android:debug-bottle-noop-java:1.0.6-support23'
    testCompile 'com.exyui.android:debug-bottle-noop-java:1.0.6-support23'

    // Use this in your Kotlin project
    releaseCompile 'com.exyui.android:debug-bottle-noop-kotlin:1.0.6-support23'
    testCompile 'com.exyui.android:debug-bottle-noop-kotlin:1.0.6-support23'

    compile 'com.android.support:appcompat-v7:23+'
}

2. Edit Manifest

Add Debug Bottle main Activity in your Manifest:

<activity
    android:name="com.exyui.android.debugbottle.components.DTDrawerActivity"
    android:theme="@style/Theme.AppCompat.Light"
    android:label="The Name You Like"/>

The value of tag label, will display to your android launch pad.

3. Inject Debug Bottle into your Application

First, you may implement Block Canary Context:

public class AppBlockCanaryContext extends BlockCanaryContext {...}

Now you could inject Debug Bottle in your Application like:

public class MyApplication extends Application{
    @Override
    public void onCreate() {
        super.onCreate();
        DTInstaller.install(this)
            .setBlockCanary(new AppBlockCanaryContext(this))
            .setOkHttpClient(httpClient)
            .setInjector("your.package.injector.ContentInjector")
            .setPackageName("your.package")
            .enable()
            .run();
    }
}

Or if you use Kotlin, you can inject like:

class MyApplication: Application() {
    override fun onCreate() {
        super.onCreate()
        DTInstaller.install(this)
            .setBlockCanary(AppBlockCanaryContext(this))
            .setOkHttpClient(httpClient)
            .setInjector("your.package.injector.ContentInjector")
            .setPackageName("your.package")
            .enable()
            .run()
    }
}

Links

License

Debug Bottle

Copyright 2016 Yuriel (http://exyui.com).

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Debug Bottle required features are based on or derives from projects below:

You might also like...
Tool for create complex morphing animations using VectorDrawables (allows morphing between any pair of SVG images)

VectAlign VectAlign (a.k.a. VectorDrawableAlign) is a developer's tool which automagically aligns two VectorDrawable "pathData" strings (or SVG images

Enhance the adb shell using busybox, supporting vi、grep and awk etc. No need root.
Enhance the adb shell using busybox, supporting vi、grep and awk etc. No need root.

super-adb 用busybox加持的功能更加强大的adb shell;不需要root。 使用方法 准备工作 安装 python,注意选择安装python 2.x 安装pexpect这个python库: pip install pexpect 下载super_adb,把它放到系统路径 cp su

The Kotlin fake data generator library!
The Kotlin fake data generator library!

Fakeit This library is a port of the Ruby gem Faker. It generates realistic fake data — like names, emails, dates, countries — for a variety of scenar

A simple utility to remove unused resources in your Android app to lower the size of the APK. It's based on the Android lint tool output.

android-resource-remover android-resource-remover is utility that removes unused resources reported by Android Lint from your project. The goal is to

This is a Android Studio/ IntelliJ IDEA plugin to localize your Android app, translate your string resources automactically.
This is a Android Studio/ IntelliJ IDEA plugin to localize your Android app, translate your string resources automactically.

#Android Localizationer This is a Android Studio/ IntelliJ IDEA plugin to localize your Android app, translate your string resources automactically. T

Automated-build-android-app-with-github-action - CI/CD Automated Build Android App Bundle / APK / Signed With Github Action
Automated-build-android-app-with-github-action - CI/CD Automated Build Android App Bundle / APK / Signed With Github Action

Automated Build Android With Using Github Action Project Github Action Script Us

proguard resource for Android by wechat team

AndResGuard Read this in other languages: English, 简体中文. AndResGuard is a tooling for reducing your apk size, it works like the ProGuard for Java sour

A super fast build tool for Android, an alternative to Instant Run
A super fast build tool for Android, an alternative to Instant Run

Freeline Freeline is a super fast build tool for Android and an alternative to Instant Run. Caching reusable class files and resource indices, it enab

Command-line tool to count per-package methods in Android .dex files

dex-method-counts Simple tool to output per-package method counts in an Android DEX executable grouped by package, to aid in getting under the 65,536

Comments
  • 设置了OkhttpClient,运行报找不到类的错误

    设置了OkhttpClient,运行报找不到类的错误

    DTInstaller.install(application) .setBlockCanary(AppBlockCanaryContext(application)) .setOkHttpClient(RetrofitManager.client) .setInjector(ContentInjector()) .enable() .run() val client: OkHttpClient by lazy { createOkHttpClient() }

    private fun createOkHttpClient(): OkHttpClient { val httpLoggingInterceptor = HttpLoggingInterceptor() httpLoggingInterceptor.level = HttpLoggingInterceptor.Level.BODY

        return OkHttpClient.Builder()
                .addInterceptor(createTokenInterceptor())
                .addInterceptor(createBodyInterceptor())
                .addInterceptor(httpLoggingInterceptor)
                .connectTimeout(30L, TimeUnit.SECONDS)
                .readTimeout(30L, TimeUnit.SECONDS)
                .writeTimeout(30L, TimeUnit.SECONDS)
                .build()
    }
    

    08-16 15:09:57.377 28075-28075/com.xd.demi.todo I/art: Rejecting re-init on previously-failed class java.lang.Class<com.exyui.android.debugbottle.components.okhttp.LoggingInterceptor>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/okhttp/Interceptor; at void com.exyui.android.debugbottle.components.DTInstaller.run() (DTInstaller.kt:218) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.squareup.okhttp.Interceptor" on path: DexPathList[[zip file "/data/app/com.xd.demi.todo-1/base.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.xd.demi.todo-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.xd.demi.todo-1/lib/arm64, /data/app/com.xd.demi.todo-1/base.apk!/lib/arm at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56) at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380) at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312) at void com.exyui.android.debugbottle.components.DTInstaller.run() (DTInstaller.kt:218) at void com.xd.demi.TDLApplication.initDeBugBottle() (TDLApplication.kt:64) at void com.xd.demi.TDLApplication.onCreate() (TDLApplication.kt:47) at void android.app.Instrumentation.callApplicationOnCreate(android.app.Application) (Instrumentation.java:1027)

    我看了下是run方法中 调用了OkHttpLoader的load方法,load()中new了一个LoggingInterceptor(),这个是com.squareup.okhttp.Interceptor包里的 现在都是 com.squareup.okhttp3.Interceptor了

    opened by Demidong 0
  • AS 3.1中编译失败

    AS 3.1中编译失败

    在AS 3.1.0 中,添加依赖之后,Sync成功,编译失败,这是相关日志 Exception in thread "main" java.lang.NullPointerException: Couldn't find outer class com/exyui/android/debugbottle/components/DTDrawerActivity$infoLayout$2$1$1 of com/exyui/android/debugbottle/components/DTDrawerActivity$infoLayout$2$1$1$1 at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:1079) at com.google.devtools.build.android.desugar.ClassVsInterface.isOuterInterface(ClassVsInterface.java:56) at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitOuterClass(InterfaceDesugaring.java:246) at org.objectweb.asm.ClassReader.accept(ClassReader.java:638) at org.objectweb.asm.ClassReader.accept(ClassReader.java:500) at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:477) at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:361) at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:314) at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:711)

    opened by chenfei0928 3
  • about version 1.1

    about version 1.1

    I found this project updated okhttp3.0 component yesterday, when it can be used?Readme now seems to be 1.0.6,and there is no getOkHttp3Interceptor method in 1.0.6!so sad!

    opened by ClownQiang 0
Releases(v1.0.4)
Annotation based simple API flavored with AOP to handle new Android runtime permission model

Let Annotation based simple API flavoured with AOP to handle new Android runtime permission model. If you check Google's Samples about the new permiss

Can Elmas 530 Nov 25, 2022
Analytics Tools for Kotlin Multiplatform Mobile iOS and android

Index Features Example Introduce Architecture Installation Configure Using Screen Mapper Initialization Implementation Delegate Parameters ATEventPara

LINE 16 Dec 5, 2022
A tool to install components of the Android SDK into a Maven repository or repository manager to use with the Android Maven Plugin, Gradle and other tools.

Maven Android SDK Deployer Original author including numerous fixes and changes: Manfred Moser [email protected] at simpligility technologies i

simpligility 1.4k Dec 27, 2022
A tool to install components of the Android SDK into a Maven repository or repository manager to use with the Android Maven Plugin, Gradle and other tools.

Maven Android SDK Deployer Original author including numerous fixes and changes: Manfred Moser [email protected] at simpligility technologies i

simpligility 1.4k Dec 27, 2022
Combines tools for fast android app devlopment

Android - Rapid Test Driven Development Combine tools to generate most of the boilerplate code. Examples how to test different aspects of an android a

Nico Küchler 379 Nov 25, 2022
A set of Android tools that facilitate apps development

A set of Android tools that facilitate apps development Well, this repo contains pretty much code used internally at Stanfy to develop Android apps. S

Stanfy 183 Dec 3, 2022
An easy to use translation / localization api written in Kotlin that can be used with Java and Kotlin

KTranslate KTranslate is an easy to use TranslationAPI written in Kotlin, with currently 26 supported languages. It is very easy to use in Kotlin and

Felix Beinssen 0 Sep 2, 2022
Sweet Android libraries written in Kotlin

Kandy A Kotlin library set dedicated to Android platform which will make programming sweet again! Repository All modules are available on the jcenter.

Kwezal 19 Jul 18, 2021
A CLI client for Up Bank, written in Kotlin.

upperkt pronounced /ˈʌpəkʌt/ Uppercut your Up balance today! (It's a CLI client for Up - an Australian neobank, written in Kotlin) Installing Right no

Duale Siad 2 Dec 3, 2021