Skip to content

A tool to report Android application bugs directly into JIRA / GitHub/ BitBucket Issue Tracker.

License

Notifications You must be signed in to change notification settings

MoodupDev/DebuggIt-Android

Repository files navigation

debugg.it

https://debugg.it

Table of Contents

This is a library-project, which provides a tool to report Android application bugs directly into JIRA / GitHub/ BitBucket Issue Tracker.

You can set up debugg.it as gradle dependency or as a module.

Add these lines to your module's build.gradle file:

repositories {
    jcenter()
}
dependencies {
    implementation 'com.mooduplabs:debuggit:1.1.1'
}

Clone this repo.

Add this library into your project as module (File -> New -> Import Module).

Add following lines to your app-level build.gradle file:

dependencies {
    compile project(path: ':debuggit')
}
Configurations

debugg.it is delivered with 2 configurations: debug and release.

The debug configuration is not minified by ProGuard. If you want to use this configuration, add configuration parameter to your compile project method and set it to 'debug':

dependencies {
    compile project(path: ':debuggit', configuration: 'debug')
}
Flavors

If your project has many product flavors, you can use this syntax:

    productFlavors {
        staging {
            applicationId "com.example.app.staging"
        }

        production {
            applicationId "com.example.app"
        }
    }

dependencies {
    stagingCompile project(path: ':debuggit', configuration: 'debug')
    productionCompile project(path: ':debuggit', configuration: 'release')
}
  1. Create a class which extends Application class
  2. Add newly created application class name into your AndroidManifest.xml file
  3. Add permissions to AndroidManifest.xml file
  4. Configure and init debugg.it in Application class
  5. Attach debugg.it to Activity class

This is required so that we can init debugg.it together with application.

Example
public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
    }
}

If your new class is MyApplication.class:

<manifest … >

  <uses-permission … />
  <uses-permission … />

  <application
    android:name=".MyApplication"
    … >
      <activity … />
      <activity … />
   </application>
</manifest>

Add these permissions to AndroidManifest.xml file:

<uses-permission android:name="android.permission.INTERNET" />

In Application class onCreate() method, you have to configure and init debugg.it. There are two things that needs to be configured:

  • Service where issues will be reported
  • API for uploading image files and (optionally) audio files
Configure service for issues

debugg.it currently supports BitBucket, GitHub and JIRA.

  • BitBucket

    • DebuggIt.getInstance().configureBitbucket("repoName", "ownerName");
    • where
      • repoName is your repository name
      • ownerName is username of repository owner
    • Enable an issue tracker on the Bitbucket repository that will use debugg.it
  • GitHub

    • DebuggIt.getInstance().configureGitHub("repoName", "ownerName");
    • where
      • repoName is your repository name
      • ownerName is username of repository owner
  • JIRA

    • DebuggIt.getInstance().configureJira("host", "projectKey");
    • where
      • host hostname of your JIRA server (e.g. yourcompany.atlassian.net)
      • projectKey is key of your project
    • If your host don't use SSL use this method: DebuggIt.getInstance().configureJira("host", "projectKey", false);
API for uploading image files and (optionally) audio files

debugg.it requires an API where it can send image files and (optionally) audio files. There are 3 available configurations:

  • AWS S3 Bucket

    This configuration uses your AWS S3 bucket (https://aws.amazon.com/s3/) to store image and audio files.

    • DebuggIt.getInstance().configureS3Bucket("bucketName", "accessKey", "secretKey", "region");
      • where
        • bucketName is a name of your bucket
        • accessKey is your user's access key
        • secretKey is your user's secret key
        • region is a region where your S3 bucket is hosted

    We recommend that you create a separate user for debugg.it via AWS Identity and Access Management (IAM) with Read and Write Access to your S3 bucket.

  • Default API

    This configuration uses your backend to send image and audio files.

    • DebuggIt.getInstance().configureDefaultApi("baseUrl", "uploadImageEndpoint", "uploadAudioEndpoint");
    • where
      • baseUrl is a base url of your backend (e.g. https://url-to-backend.com)
      • uploadImageEndpoint is an url to endpoint handling image upload (e.g. /debuggit/uploadImage)
      • uploadAudioEndpoint is an url to endpoint handling audio upload (e.g. /debuggit/uploadAudio)

  • Custom API

    This is an extension of default API configuration. The difference is that you have to handle uploadImage / uploadAudio request and response. You are responsible for communication with your backend, but at the same time you have full control over it.

    • DebuggIt.getInstance().configureCustomApi(apiInterface);
    • where
      • apiInterface is an interface that has two methods: uploadImage and uploadAudio
        • public void uploadImage(String imageData, JsonResponseCallback callback);
        • public void uploadAudio(String audioData, JsonResponseCallback callback);
        • where
          • imageData / audioData is a Base64 encoded bitmap / audio file.
          • callback is a Base64 encoded bitmap / audio file.
Init debugg.it

After configuration is done, call at the end:

DebuggIt.getInstance().init();

Sample configurations

  • Init BitBucket with S3:

DebuggIt.getInstance()
        .configureS3Bucket("bucketName", "accessKey", "secretKey", "region");
        .configureBitbucket("repoName", "ownerName");
        .init();
  • Init GitHub with default API:

DebuggIt.getInstance()
        .configureDefaultApi("baseUrl", "uploadImageEndpoint", "uploadAudioEndpoint");
        .configureGitHub("host", "projectKey");
        .init();
  • Init JIRA with custom API:

DebuggIt.getInstance()
        .configureCustomApi(new ApiInterface() {
                            @Override
                            public void uploadImage(String imageData, JsonResponseCallback callback) {
                                // Handle API call to your backend and call onSuccess callback with JSONObject response
                                // callback.onSuccess(response);

                                // If something went wrong, call onFailure callback
                                // callback.onFailure(400, "Could not upload image");
                            }

                            @Override
                            public void uploadAudio(String audioData, JsonResponseCallback callback) {
                                // Handle API call to your backend and call onSuccess callback with JSONObject response
                                // callback.onSuccess(response);

                                // If something went wrong, call onFailure callback
                                // callback.onFailure(400, "Could not upload audio");
                            }
                        })
        .configureJira("host", "projectKey");
        .init();

Add these methods in your Activity classes (preferably just in base activity class)

  • Add this method to onStart():

DebuggIt.getInstance().attach(this);

  • Add this method to onActivityResult():

DebuggIt.getInstance().getScreenshotPermission(requestCode, resultCode, data);

Example
public abstract class BaseActivity extends AppCompatActivity {
    @Override
    protected void onStart() {
        super.onStart();
        DebuggIt.getInstance().attach(this);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        DebuggIt.getInstance().getScreenshotPermission(requestCode, resultCode, data);
    }
}

That's all. Your debugg.it is ready to work.

debugg.it allows to record audio notes and add it to bug description. To enable this feature simply add this line to your configuration in Application class:

DebuggIt.getInstance().setRecordingEnabled(true);

Ensure you have added RECORD_AUDIO permission in AndroidManifest.xml file:

<uses-permission android:name="android.permission.RECORD_AUDIO" />
Copyright 2019 MoodUp Team

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.

About

A tool to report Android application bugs directly into JIRA / GitHub/ BitBucket Issue Tracker.

Resources

License

Stars

Watchers

Forks

Packages

No packages published