acra

Post on 20-Jun-2015

1.611 Views

Category:

Technology

3 Downloads

Preview:

Click to see full reader

DESCRIPTION

Présentation élaborée par Mlle. Sonia dans le cadre des sessions de Lightning Talks à l'Orange Developer Center.

TRANSCRIPT

1ZID Sonia – 26/12/2013

Application Crash Report for Android

2

Plan de présentation

● Oui il vous faut un outil de rapports d'erreur● ACRA : Application crash reports for Android● Top applications qui utilisent ACRA● Simple à intégrer● Les solutions de stockage et analyse● Acralyser

3

Oui il vous faut un outil de rapport d'erreur

● Votre application va planter. C'est sûr, oui je suis sûr.

● Vos tests se sont jamais suffisants

● Vous ne pourrez jamais tester sur TOUS les devices et versions d'Android.

4

Oui il vous faut un outil de rapport d'erreur

Connaitre les défauts au plus tot pour les corriger au plus vite

N'est ce pas !

5

Oui il vous faut un outil de rapport d'erreur

Oui mais Google fournit déjà des rapports d'erreur !

MAIS...● Les données sont limités● Dépendant du Play Store● Et pour les applications d'entreprise ?

6

Application Crash Report for Android

Idée initiale● Tout développeur devrait recevoir des rapports

d'erreur

● Impact minimal sur l'application

● Utilisation de Google Docs pour les rapports d'erreur.

7

Application Crash Report for Android

Principe : UncaughtExceptionHandler

→ appelé par toute exception non intercepté

Installation : ajout d'une simple annotation sur l'instance Application Principale

Compatibilité : avec toutes versions d'Android mais sait collecter des données avec les API les plus récents.

8

Application Crash Report for Android● Interaction utilisateur

- Toast, Notification, Dialog, rapports silencieux

● Rapports très détaillés sur le crash, le device avec lequel l'application s'est arrété,...

● On peut ajouter nos propres traces de débogage pour les rapports.

● S'il y a pas de couverture réseau, les rapports sont conservés et envoyés plus tard.

● On peut envoyer des rapports meme si l'application ne plante pas.

9

Top applications qui utilisent ACRA

10

Simple à intégrer

Crash Reports in a Google Docs spreadsheet● Get http://acra.googlecode.com/files/acra-3.1.2.2.zip and open the

archive● Login to your Google Docs account● Import the CrashReports-template.csv contained in the archive (acra-

3.1.2.2/CrashReport/doc), with conversion enabled● Open the imported document● Rename it as you like● In the menu, click on Forms / Create form● Add anything in the form description just to enable the Save button● If you are using a private Google Apps domain, make sure to uncheck

the option "Require yourdomain.com sign-in to view this form."

11

Simple à intégrer

● Save the form● Copy the formkey displayed in the link at the bottom of the form

creation page● Open your Eclipse project● Create a lib folder● Add the acra-3.1.2.2.jar from the archive (acra-

3.1.2.2/CrashReport/build) in the lib folder● Right-click on the jar file / add to build path● Create a new class in your package root● Give it a name like: MyApplication, make it extend

android.app.Application● Above the declaration of the MyApplication class, add the

@ReportsCrashes annotation with your Google Docs form Id as a parameter

12

Simple à intégrer

package com.example.test

import org.acra.ACRA;import org.acra.ReportField;import org.acra.ReportingInteractionMode;import org.acra.annotation.ReportsCrashes;

import android.app.Application;

@ReportsCrashes (formKey = "dGVacG0ydVHnaNHjRjVTUTEtb3FPWGc6MQ",, customReportContent = {ReportField.APP_VERSION_CODE, ReportField.APP_VERSION_NAME,ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL,ReportField.CUSTOM_DATA, ReportField.STACK_TRACE }, mode = ReportingInteractionMode.TOAST,resToastText = R.string.crash_toast_text)

public class MyApplication extends Application {

@Overridepublic void onCreate() {// TODO Auto-generated method stubsuper.onCreate();ACRA.init(this);}

}

13

Simple à intégrer● APP_VERSION_CODE=1● APP_VERSION_NAME=1.0● ANDROID_VERSION=4.4.2● PHONE_MODEL=Nexus 4● CUSTOM_DATA=● STACK_TRACE=java.lang.NumberFormatException: Invalid int: ""● at java.lang.Integer.invalidInt(Integer.java:137)● at java.lang.Integer.parseInt(Integer.java:358)● at java.lang.Integer.parseInt(Integer.java:331)● at

com.exemple.test.activity.ListAudioGuideExpositionActivity$23.onClick(ListAudioGuideExpositionActivity.java:578)

● at android.view.View.performClick(View.java:4438)● at android.view.View$PerformClick.run(View.java:18422)● at android.os.Handler.handleCallback(Handler.java:733)● at android.os.Handler.dispatchMessage(Handler.java:95)● at android.os.Looper.loop(Looper.java:136)● at android.app.ActivityThread.main(ActivityThread.java:5017)● at java.lang.reflect.Method.invokeNative(Native Method)● at java.lang.reflect.Method.invoke(Method.java:515)● at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)● at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)● at dalvik.system.NativeStart.main(Native Method)

mode = ReportingInteractionMode.TOAST

14

Simple à intégrer

@ReportsCrashes(formKey="dGVacG0ydVHnaNHjRjVTUTEtb3FPWGc6MQ,mode = ReportingInteractionMode.Notification,resToastText = R.string.crash_toast_text)public class MyApplication extends Application {...

15

Les solutions de stockage et analyse

Google Docs Forms● Pratique pour démarrer● Interface pas vraiment adaptée● Google a demandé l'arret de la soumission

des données via Forms.

Déconseillée

16

Les solutions de stockage et analyse

Solutions commerciales/propriétaires

17

Les solutions de stockage et analyse

Solutions commerciales/propriétaires

● Avantage

Interfaces soignées● Inconvénients

Peu de données

Persistance des données limités dans le temps

Tarification

SAAS → Les données sont chez un tiers et y resteront

18

Les solutions de stockage et analyse

Autre solutions

● Un Script PHP de 10 lignes peut etre suffisant● Sentry - Python + MySQL/PgSQL

solutions installable sur votre infra

proposent un hébergement payant● Acralyzer

19

Acralyser

Nouveau backend officiel pour ACRA

Pallier au retrait de la solution Google Forms● Création / suppression de rapports● Visualisation de TOUTES les données● Tri/Recherche

Solution FULL opensource● Pas de dépendance vis à vis d'un service● Facile à déployer "chez soi"

Robuste et Scalable

20

Acralyser

Installation :

1 - réplication de 2 couchapps● http://get.acralyzer.com/distrib-acra-storage● http://get.acralyzer.com/distrib-acralyzer

2 - Création d'un utilisateur reporter● Depuis l'interface d'Acralyzer

3 - Configuration d'ACRA

21

Acralyser

Fonctionnalités implémentées

- Dashboard:● rapports par mois/jour/heure/seconde● rapports par version Android/API/Applicative● rapports par device

- 10 derniers bugs et rapports :● version applicative● exception + classe / ligne● root exception + classe / ligne

22

Acralyser

Fonctionnalités implémentées

- Bugs :● Etat résolu ou non● Champ commentaires● Liste des rapports● Liste des utilisateurs impactés

- Rapports :● Filtre par version application ou Android● Recherche textuelle

23

Acralyser

24

Références

● https://code.google.com/p/acra/wiki/ACRA3HowTo

● https://github.com/ACRA/acra

● https://plus.google.com/+Acralyzer/posts

● https://github.com/ACRA/acra/wiki/AdvancedUsage#contents

25

Merci de votre attention

top related