3

We just downloaded the latest version of ET lib for android (3.5.0) and are trying to do a sample to make it work but facing some issue:

The steps which we followed is:

Step 1:

Extended Application class onCreate we added :

EventBus.getDefault().register(this);
            ETPush.readyAimFire(this, "AppID", "TOKEN","GCM_SENDER_ID", true, true, true, true);

Step 2 :

Overriden the method in application class:

public void onEvent(final RegistrationEvent event) {
}

Step 3: In our mainActivity onCreate we are calling:

ETPush pushManager = ETPush.pushManager(); // Throws exception the logs are below
pushManager.enablePush();

*************************EXCEPTION DETAILS ************************************

1st one : com.exacttarget.etpushsdk.ETException: Initialization did not complete in a timely fashion.

2nd One :

03-20 10:59:07.139: E/AndroidRuntime(12548): FATAL EXCEPTION: AsyncTask #1 03-20 10:59:07.139: E/AndroidRuntime(12548): Process: OUR_PACKAGE, PID: 12548 03-20 10:59:07.139: E/AndroidRuntime(12548): java.lang.RuntimeException: An error occured while executing doInBackground() 03-20 10:59:07.139: E/AndroidRuntime(12548): at android.os.AsyncTask$3.done(AsyncTask.java:304) 03-20 10:59:07.139: E/AndroidRuntime(12548): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) 03-20 10:59:07.139: E/AndroidRuntime(12548): at java.util.concurrent.FutureTask.setException(FutureTask.java:222) 03-20 10:59:07.139: E/AndroidRuntime(12548): at java.util.concurrent.FutureTask.run(FutureTask.java:242) 03-20 10:59:07.139: E/AndroidRuntime(12548): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 03-20 10:59:07.139: E/AndroidRuntime(12548): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 03-20 10:59:07.139: E/AndroidRuntime(12548): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 03-20 10:59:07.139: E/AndroidRuntime(12548): at java.lang.Thread.run(Thread.java:818) 03-20 10:59:07.139: E/AndroidRuntime(12548): Caused by: java.lang.NoClassDefFoundError: com.exacttarget.etpushsdk.ETLocationManager$RegionMonitor 03-20 10:59:07.139: E/AndroidRuntime(12548): at com.exacttarget.etpushsdk.ETLocationManager.(ETLocationManager.java:179) 03-20 10:59:07.139: E/AndroidRuntime(12548): at com.exacttarget.etpushsdk.ETLocationManager.readyAimFire(ETLocationManager.java:219) 03-20 10:59:07.139: E/AndroidRuntime(12548): at com.exacttarget.etpushsdk.ETPush$1.doInBackground(ETPush.java:269) 03-20 10:59:07.139: E/AndroidRuntime(12548): at com.exacttarget.etpushsdk.ETPush$1.doInBackground(ETPush.java:227) 03-20 10:59:07.139: E/AndroidRuntime(12548): at android.os.AsyncTask$2.call(AsyncTask.java:292) 03-20 10:59:07.139: E/AndroidRuntime(12548): at java.util.concurrent.FutureTask.run(FutureTask.java:237)

Let me know what configuration we are missing. We are trying to build it using android 4.4.2

4

This line: Caused by: java.lang.NoClassDefFoundError: com.exacttarget.etpushsdk.ETLocationManager$RegionMonitor

indicates that the reason for the crash is that it is unable to find RegionMonitor which is a class defined within ETLocationManager.

Do you have Proguard turned on? If so, please review the Proguard statements in proguard.cfg which we use for the SDK Explorer, which is a sample app that we provide to showcase the SDK:

https://github.com/ExactTarget/JB4A-SDK-Android/blob/master/JB4A-SDK-Explorer/gradle-build/app/proguard.cfg

Specifically, look to include the following statement which will keep all classes and members of the SDK:

-keep class com.exacttarget.etpushsdk.** { *; }

I also wanted to find out whether you are licensed for using Location and Rich Push? If not, you could also turn off Location and CloudPage Inbox messages and save overhead if you are not going to be using Geofencing or using a CloudPage Inbox within your application. Do that by turning off Location and CloudPages in your readyAimFireCall() as follows: ETPush.readyAimFire(this, "AppID", "TOKEN","GCM_SENDER_ID", true, true, false, false);

Of course, the Proguard statements are still applicable, but wanted to let you know to look into turning these options off if you're not using them in your app.

  • Thanks Peter turning off the location and cloudpage inbox by setting the attributes to false did the trick. But yes i still have a doubt w.r.t the NoClassDefFoundError for RegionMonitor , in our sample app the proguard was not enabled still we were seeing this. But turning off the location and cloudpage doesn't make it to crash is it because after turning off these the RegionMonitor class isn't used. Also, what could be the other probable reason of getting this NoClassDefFoundError for RegionMonitor. – Deva Mar 23 '15 at 19:32
  • We ran a quick test with a small "hello world app" and readyAimFire() with everything true worked fine. Can you share more about the project? Are you using Gradle with aar file? Or Eclipse with jar? If gradle, can you post your gradle build file? And can you verify sizes of jar or aar you pulled from gitHub? – Peter Van Dyk Mar 24 '15 at 16:49
0

For those who need to use Location and have

java.lang.NoClassDefFoundError: com.exacttarget.etpushsdk.ETLocationManager$RegionMonitor

Roll back play-services version, next change solved issue for me. in

build.gradle

    ...
    dependencies {
    ...
    //  use old instead of new because ET location service does not work on new one
    //  compile 'com.google.android.gms:play-services:7.5.0'
        compile 'com.google.android.gms:play-services:6.1.71'
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.