Skip to content

Instantly share code, notes, and snippets.

Avatar

Halyson Lima Gonçalves halysongoncalves

View GitHub Profile
@ZakTaccardi
ZakTaccardi / build.gradle
Created Aug 26, 2015
Automatic per-variant google_services.json configurations with Gradle
View build.gradle
//append code below to existing build.gradle
def appModuleRootFolder = '.'
def srcDir = 'src'
def googleServicesJson = 'google-services.json'
task switchToDebug(type: Copy) {
def buildType = 'debug'
description = 'Switches to DEBUG google-services.json'
from "${srcDir}/${buildType}"
@felipecsl
felipecsl / ExceptionParser.java
Last active Jan 28, 2019
Helper class to parse error response body on Retrofit 2
View ExceptionParser.java
public static class ExceptionParser {
private final ResponseBody body;
private final String bodyString;
private final Converter.Factory converterFactory;
public ExceptionParser(Response response, Converter.Factory converterFactory) {
this.converterFactory = converterFactory;
this.body = cloneResponseBody(response.errorBody());
this.bodyString = getBodyAsString(body);
}