Farzan Najipour
Farzan Najipour

Reputation: 2493

Android - Acra doesn't report

I'trying to use ACRA as bug reporter, I added acra-4.6.1.jar to my project and made this class

ReportApp.java

package org.qtproject.example.ourmessenger;

import org.acra.*;
import org.acra.annotation.*;
import org.qtproject.qt5.android.bindings.QtApplication;
import android.app.Application;



@ReportsCrashes(
    formUri = "http://######/#####/######/####.php",
    formUriBasicAuthLogin = "root",
    formUriBasicAuthPassword = "#######",
    mode = ReportingInteractionMode.TOAST,
    forceCloseDialogAfterToast = false, 
    resToastText = R.string.crash_toast_text
    )
public class ReportApp extends Application  {

    @Override
    public void onCreate() {
        super.onCreate();

        ACRA.init(this);
    }
}

Then , I edited my android:name on AndroidManifest:

AndoridManifest.xml

<application android:hardwareAccelerated="true" android:name="org.qtproject.example.ourmessenger.ReportApp" android:label="@string/app_name" android:icon="@drawable/icon">

Also I added this line in the end of AndroidManifest.xml before </manifest>:

 <CheckBoxPreference android:key="acra.enable" android:title="@string/pref_enable_acra" android:summaryOn="@string/pref_acra_enabled" android:summaryOff="@string/pref_acra_disabled" android:defaultValue="true"/>

and I use this

String i=null;
i.contains("kj");

for testing ACRA. Actually it doesn't work. I'm not added anything to mainActivity.

MainActivity.java

 .
 .
public class MainActivity extends QtActivity implements SensorEventListener
{
    .
    .
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        Context context = getApplicationContext();
        SharedPreferences appPref = getSharedPreferences("isFirstRun", 0);
        boolean isFirstRun = appPref.getBoolean("isFirstRun", true);
        .
        .

    }
     .
     .
}

It's not only doesn't show any TOAST message but also doesn't report to server.Any suggestion?

Upvotes: 0

Views: 512

Answers (2)

Philippe Lelong
Philippe Lelong

Reputation: 21

I am also trying to use ACRA with a qt-android project, and it doesn't report anything as well, whether I call abort() or force an error elsewhere.

I see that it initializes correctly, but when I force a crash I just get the regular Android crash message and no toast nor email. I/qtVlmApp(22971): onCreate qtVlmApp D/ACRA (22971): ACRA is enabled for org.meltemus.qtvlm, initializing... D/ACRA (22971): Using default Mail Report Fields W/ACRA (22971): org.meltemus.qtvlm reports will be sent by email (if accepted by user). D/ACRA (22971): Looking for error files in /data/data/org.meltemus.qtvlm/files I/Qt (22971): qt start I/QtPositioning(22971): Positioning start ..... ..... F/libc (22971): Fatal signal 11 (SIGSEGV), code 1, fault addr 0xb9ce2008 in tid 7981 (Thread (pooled))

Maybe Acra cannot work in an android-qt application (c++) ?

Upvotes: 1

fluffyBatman
fluffyBatman

Reputation: 6704

You need to mention the request type in @ReportsCrashes for your targeted service. For your formUri = "http://######/#####/######/####.php"service which is essentially either a POST or PUT service, add httpMethod = org.acra.sender.HttpSender.Method.POST or httpMethod = org.acra.sender.HttpSender.Method.PUT in @ReportsCrashes block.

See the doc for more details.

Upvotes: 1

Related Questions