A tiny window overlay to log app internal on top of your android app

Related tags

UI/UX debugoverlay
Overview

DebugOverlay

A logcat alike overlay to display log messages in your app as independent overlay.

Typically in android you would log some app internals for debugging puropose by using Log.d(). However, sometimes you may need to display that logging messages right on the screen to make them visible for non developers that have to verify certain app internals, like tracking.

DebugOverlay

This tiny library adds an overlay as independent Window on top of your android application. You can close this DebugOverlay-Window by clicking on the close button. The window will then automatically pop up again when the next message to log is detected.

How to use it

DebugOverlay.with(context).log("My logging message");

Dependencies

Obviously you wont deliver this DebugOverlay with you production code in the play store .apk file. Hence this library provides two maven artifacts to include.

debugCompile('com.hannesdorfmann:debugoverlay:0.4.0') // Starts the service and displays the overlay
releaseCompile('com.hannesdorfmann:debugoverlay-noop:0.4.0') // Does nothing

The idea is to use gradle build types to add the DebugOverlay only to debug builds. debugoverlay is the real implementation and displays the window while debugoverlay-noop is a stub and simply does nothing!

Permissions

Please note that com.hannesdorfmann:debugoverlay:0.4.0 will add android.permission.SYSTEM_ALERT_WINDOW to your apk. Hence you should avoid to use that dependency for your release .apk

Features

The api is very simple. You can simply log string messages. You can open new issues here on github to make a new feature request. If it is not too complicated and will not add a lot of new methods to the public API (dex count 65k limit) then it's very likely that we can add this feature to this library.

License

Copyright 2015 Hannes Dorfmann

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.
You might also like...
Make a cool intro for your Android app.
Make a cool intro for your Android app.

AppIntro AppIntro is an Android Library that helps you build a cool carousel intro for your App. AppIntro has support for requesting permissions and h

StandOut lets you easily create floating windows in your Android app.

Coming Soon Meanwhile, checkout the demo video at http://www.youtube.com/watch?v=S3vHjxonOeg Join the conversation at http://forum.xda-developers.com/

Android Material Json Form Wizard is a library for creating beautiful form based wizards within your app just by defining json in a particular format.
Android Material Json Form Wizard is a library for creating beautiful form based wizards within your app just by defining json in a particular format.

Android Json Wizard Android Json Wizard is a library for creating beautiful form based wizards within your app just by defining json in a particular f

Make a cool intro for your Android app.
Make a cool intro for your Android app.

AppIntro AppIntro is an Android Library that helps you build a cool carousel intro for your App. AppIntro has support for requesting permissions and h

Highligth specific points of interest of your app
Highligth specific points of interest of your app

ShowTipsView ShowTipsView let you highligth specific points of interest of your app. Usage ShowTipsView showtips = new ShowTipsBuilder(this) .setTarg

[Archived] Highlight the best bits of your app to users quickly, simply, and cool...ly
[Archived] Highlight the best bits of your app to users quickly, simply, and cool...ly

ShowcaseView The ShowcaseView (SCV) library is designed to highlight and showcase specific parts of apps to the user with a distinctive and attractive

A simple screen that is shown when your app gets crashed instead of the normal crash dialog. It's very similar to the one in Flutter.
A simple screen that is shown when your app gets crashed instead of the normal crash dialog. It's very similar to the one in Flutter.

Red Screen Of Death What A simple screen that is shown when your app gets crashed instead of the normal crash dialog. It's very similar to the one in

AcaryaApp - An App made for Changing your lifestyle
AcaryaApp - An App made for Changing your lifestyle

AcaryaApp: An App made for Changing your lifestyle Problem Statement People nowa

This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.
This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.

Note: we are not actively responding to issues right now. If you find a bug, please submit a PR. Android Sliding Up Panel This library provides a simp

Comments
  • android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@a59d688 -- permission denied for window type 2038

    android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@a59d688 -- permission denied for window type 2038

    In my Fragment I have the following code:

        @Override
        public void onResume() {
            super.onResume();
            DebugOverlay.with(getContext()).log("Hello");
        }
    

    In the AndroidManifest.xml: <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

    And I'm getting following error:

                      android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@a59d688 -- permission denied for window type 2038
                          at android.view.ViewRootImpl.setView(ViewRootImpl.java:789)
                          at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:356)
                          at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
                          at com.hannesdorfmann.debugoverlay.DebugOverlayView.<init>(DebugOverlayView.java:80)
                          at com.hannesdorfmann.debugoverlay.DebugOverlayService.logMsg(DebugOverlayService.java:36)
                          at com.hannesdorfmann.debugoverlay.DebugOverlay$MessageDispatcher.dispatch(DebugOverlay.java:118)
                          at com.hannesdorfmann.debugoverlay.DebugOverlay$MessageDispatcher.setService(DebugOverlay.java:87)
                          at com.hannesdorfmann.debugoverlay.DebugOverlay$1.onServiceConnected(DebugOverlay.java:27)
                          at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1652)
                          at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1681)
                          at android.os.Handler.handleCallback(Handler.java:790)
                          at android.os.Handler.dispatchMessage(Handler.java:99)
                          at android.os.Looper.loop(Looper.java:164)
                          at android.app.ActivityThread.main(ActivityThread.java:6494)
                          at java.lang.reflect.Method.invoke(Native Method)
                          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
    

    Android version: Oreo. Am I doing something wrong or is it a bug?

    opened by piotrek-chmielowski 4
  • Do not crash when log called on a background thread

    Do not crash when log called on a background thread

    When DebugOverlay.with(this).log("Message"); is called on a background thread, CalledFromWrongThreadException occur with the following stack trace:

    android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
                                                                                                at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:7286)
                                                                                                at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:1155)
                                                                                                at android.view.View.requestLayout(View.java:21926)
                                                                                                at android.view.View.requestLayout(View.java:21926)
                                                                                                at android.widget.AbsListView.requestLayout(AbsListView.java:1998)
                                                                                                at android.widget.AdapterView$AdapterDataSetObserver.onChanged(AdapterView.java:848)
                                                                                                at android.widget.AbsListView$AdapterDataSetObserver.onChanged(AbsListView.java:6414)
                                                                                                at android.database.DataSetObservable.notifyChanged(DataSetObservable.java:37)
                                                                                                at android.widget.BaseAdapter.notifyDataSetChanged(BaseAdapter.java:50)
                                                                                                at com.hannesdorfmann.debugoverlay.DebugOverlayView.addMessage(DebugOverlayView.java:90)
                                                                                                at com.hannesdorfmann.debugoverlay.DebugOverlayService.logMsg(DebugOverlayService.java:45)
                                                                                                at com.hannesdorfmann.debugoverlay.DebugOverlay$MessageDispatcher.dispatch(DebugOverlay.java:118)
                                                                                                at com.hannesdorfmann.debugoverlay.DebugOverlay$MessageDispatcher.enqueueMessage(DebugOverlay.java:101)
                                                                                                at com.hannesdorfmann.debugoverlay.DebugOverlay.log(DebugOverlay.java:54)
    

    To reproduce it, please checkout 898d23f commit from this pull request, set Foregroung thread switch to false and press fab more than once.

    Commit cf66434 fixes this issue by invoking view.addMessage(msg) on the UI thread.

    opened by pchmielowski 2
  • Extra file in the 0.2.0 Maven release

    Extra file in the 0.2.0 Maven release

    It looks like an extra class file got included in the 0.2.0 .AAR file. Here's the error I get when ProGuard gets run:

    Warning: com.hannesdorfmann.debugoverlay.DebugOverlayService$logMsg$1: can't find referenced method 'void destroyView()' in program class com.hannesdorfmann.debugoverlay.DebugOverlayService
    Warning: com.hannesdorfmann.debugoverlay.DebugOverlayService$logMsg$1: can't find referenced class kotlin.jvm.internal.KotlinSyntheticClass
    Warning: com.hannesdorfmann.debugoverlay.DebugOverlayService$logMsg$1: can't find referenced class kotlin.jvm.internal.KotlinSyntheticClass$Kind
    Warning: com.hannesdorfmann.debugoverlay.DebugOverlayService$logMsg$1: can't find referenced class kotlin.jvm.internal.KotlinCallable
    

    If I look at the contents of the .AAR downloaded from Maven Central, it contains these classes:

    ➜  maven  jar xf debugoverlay-0.2.0.aar && jar tvf classes.jar
         0 Wed Oct 14 03:29:26 CEST 2015 META-INF/
        25 Wed Oct 14 03:29:26 CEST 2015 META-INF/MANIFEST.MF
         0 Wed Oct 14 00:53:56 CEST 2015 com/
         0 Wed Oct 14 00:53:56 CEST 2015 com/hannesdorfmann/
         0 Wed Oct 14 03:29:26 CEST 2015 com/hannesdorfmann/debugoverlay/
       615 Wed Oct 14 03:29:26 CEST 2015 com/hannesdorfmann/debugoverlay/BuildConfig.class
      1823 Wed Oct 14 03:29:26 CEST 2015 com/hannesdorfmann/debugoverlay/DebugOverlay$1.class
      2346 Wed Oct 14 03:29:26 CEST 2015 com/hannesdorfmann/debugoverlay/DebugOverlay$MessageDispatcher.class
      3019 Wed Oct 14 03:29:26 CEST 2015 com/hannesdorfmann/debugoverlay/DebugOverlay.class
       945 Wed Oct 14 03:29:26 CEST 2015 com/hannesdorfmann/debugoverlay/DebugOverlayService$1.class
       813 Wed Oct 14 03:29:26 CEST 2015 com/hannesdorfmann/debugoverlay/DebugOverlayService$DebugOverlayServiceBinder.class
      1364 Wed Oct 14 03:03:58 CEST 2015 com/hannesdorfmann/debugoverlay/DebugOverlayService$logMsg$1.class
      2007 Wed Oct 14 03:29:26 CEST 2015 com/hannesdorfmann/debugoverlay/DebugOverlayService.class
      3823 Wed Oct 14 03:29:26 CEST 2015 com/hannesdorfmann/debugoverlay/DebugOverlayView.class
      1472 Wed Oct 14 03:29:26 CEST 2015 com/hannesdorfmann/debugoverlay/LoggingAdapter.class
      2364 Wed Oct 14 03:29:26 CEST 2015 com/hannesdorfmann/debugoverlay/SimpleAdapter.class
    

    The contents of my self-built 0.2.0 AAR file look like this:

    ➜  aar git:(cd4b8af) jar xf overlay-release.aar && jar tvf classes.jar
         0 Wed Oct 28 10:23:32 CET 2015 META-INF/
        25 Wed Oct 28 10:23:32 CET 2015 META-INF/MANIFEST.MF
         0 Wed Oct 28 10:23:32 CET 2015 com/
         0 Wed Oct 28 10:23:32 CET 2015 com/hannesdorfmann/
         0 Wed Oct 28 10:23:32 CET 2015 com/hannesdorfmann/debugoverlay/
       615 Wed Oct 28 10:23:32 CET 2015 com/hannesdorfmann/debugoverlay/BuildConfig.class
      1812 Wed Oct 28 10:23:32 CET 2015 com/hannesdorfmann/debugoverlay/DebugOverlay$1.class
      2385 Wed Oct 28 10:23:32 CET 2015 com/hannesdorfmann/debugoverlay/DebugOverlay$MessageDispatcher.class
      3020 Wed Oct 28 10:23:32 CET 2015 com/hannesdorfmann/debugoverlay/DebugOverlay.class
       938 Wed Oct 28 10:23:32 CET 2015 com/hannesdorfmann/debugoverlay/DebugOverlayService$1.class
       813 Wed Oct 28 10:23:32 CET 2015 com/hannesdorfmann/debugoverlay/DebugOverlayService$DebugOverlayServiceBinder.class
      2010 Wed Oct 28 10:23:32 CET 2015 com/hannesdorfmann/debugoverlay/DebugOverlayService.class
      3731 Wed Oct 28 10:23:32 CET 2015 com/hannesdorfmann/debugoverlay/DebugOverlayView.class
      1472 Wed Oct 28 10:23:32 CET 2015 com/hannesdorfmann/debugoverlay/LoggingAdapter.class
      2364 Wed Oct 28 10:23:32 CET 2015 com/hannesdorfmann/debugoverlay/SimpleAdapter.class
    

    I think it would be enough to re-release 0.2.0 and make sure to clean the workspace first. I'm not sure if it would be necessary to bump the version number.

    opened by scompt 2
  • Feature: add scroll buttons

    Feature: add scroll buttons

    This PR updates the appearance of the overlay to:

    • add up and down buttons to allow scrolling of recent messages displayed
    • reposition the overlay to the top of the screen. 100px beneath the top of the screen, allowing the swipe down gesture to display the notifications drawer still to function

    Creating a PR in case others find this useful

    opened by julianD77 0
Releases(0.4.0)
The ShowcaseView library is designed to highlight and showcase specific parts of apps to the user with an attractive and flat overlay.

The ShowcaseView library is designed to highlight and showcase specific parts of apps to the user with an attractive and flat overlay.

Mohammad Reza Eram 484 Dec 26, 2022
ckChangeLog - An Android Library to display a Change Log

ckChangeLog - An Android Library to display a Change Log This library provides an easy way to display a change log in your app. Features Displays chan

cketti 182 Dec 3, 2022
[] Define and render UI specs on top of your Android UI

dspec A simple way to define and render UI specs on top of your Android UI. Usage Enclose the target UI with a DesignSpecFrameLayout, usually the root

Lucas Rocha 561 Dec 16, 2022
Owasp-top-five - An intro into writing code for greater Android Security

Don’t get stung by OWASP An intro into writing code for greater Android Security

Ed George 5 Feb 13, 2022
Janishar Ali 2.1k Jan 1, 2023
TopSheet - a "top" version of BottomSheet

TopSheet - a "top" version of BottomSheet TopSheetBehaviour View sheet = findViewById(R.id.top_sheet); TopSheetBehavior.from(sheet).setState(TopSheetB

Andrea Maglie 82 Jun 24, 2022
Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your

Txus Ballesteros 1.5k Jan 2, 2023
Make your native android Toasts Fancy. A library that takes the standard Android toast to the next level with a variety of styling options. Style your toast from code.

FancyToast-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ... ma

Shashank Singhal 1.2k Dec 26, 2022
Make your native android Dialog Fancy. A library that takes the standard Android Dialog to the next level with a variety of styling options. Style your dialog from code.

FancyAlertDialog-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ..

Shashank Singhal 350 Dec 9, 2022
Useful library to use custom fonts in your android app

EasyFonts A simple and useful android library to use custom fonts in android apps without adding fonts into asset/resource folder.Also by using this l

Vijay Vankhede 419 Sep 9, 2022