2

I am trying to upgrade Apptentive from 1.7.3 version to latest 2.1.1 version. However whenever I call method
Apptentive.showMessageCenter(getActivity()), to launch Apptentive message dialog, it crashes and gives NoClassDefFoundError for ViewActivity. Logs are as below:

java.lang.NoClassDefFoundError: com.apptentive.android.sdk.ViewActivity

01-08 11:30:41.837 E/AndroidRuntime(30049): at com.apptentive.android.sdk.module.engagement.EngagementModule.launchInteraction(EngagementModule.java:75)

01-08 11:30:41.837 E/AndroidRuntime(30049): at com.apptentive.android.sdk.module.engagement.EngagementModule.doEngage(EngagementModule.java:64)

01-08 11:30:41.837 E/AndroidRuntime(30049): at com.apptentive.android.sdk.module.engagement.EngagementModule.engage(EngagementModule.java:53)

01-08 11:30:41.837 E/AndroidRuntime(30049): at com.apptentive.android.sdk.module.engagement.EngagementModule.engageInternal(EngagementModule.java:31)

01-08 11:30:41.837 E/AndroidRuntime(30049): at com.apptentive.android.sdk.ApptentiveInternal.showMessageCenterInternal(ApptentiveInternal.java:191)

01-08 11:30:41.837 E/AndroidRuntime(30049): at com.apptentive.android.sdk.Apptentive.showMessageCenter(Apptentive.java:635)

01-08 11:30:41.837 E/AndroidRuntime(30049): at com.apptentive.android.sdk.Apptentive.showMessageCenter(Apptentive.java:619)

My code in build.gradle file is:

compile 'com.apptentive:apptentive-android:2.1.1@aar'

and java code is:

    Button writeUs = (Button) fitnessSyncDialog.findViewById(R.id.button_click_write_us);
writeUs.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        Apptentive.showMessageCenter(getActivity());
    }
});

Same code is working with 1.7.3 version. has anyone faced this problem or Can anyone suggest what problem can be here?

Thanks in advance for any valuable suggestions.

Community
  • 1
  • 1
Suresh Pal
  • 21
  • 2

1 Answers1

3

It is possible that you did not include a reference to ViewActivity in your app's manifest. for example:

<meta-data android:name="apptentive_api_key" android:value="YOUR_API_KEY_GOES_HERE"/>
  <activity android:name="com.apptentive.android.sdk.ViewActivity"
            android:theme="@style/ApptentiveTheme"/>

Another possibility is that you did not include a reference to the Apptentive aar in your build.gradle . For example:

repositories {
  jcenter()
}

dependencies {
  // These Google support libraries are required. Use the latest available.
  compile 'com.android.support:support-v4:23.0.1'
  compile 'com.android.support:appcompat-v7:23.0.1'
  compile 'com.android.support:cardview-v7:23.0.1'
  // The Apptentive SDK
  compile 'com.apptentive:apptentive-android:2.1.1@aar'
}

More info can be found here http://www.apptentive.com/docs/android/integration/

Jake
  • 251
  • 4
  • 4
  • Hi Jake,Thanks for response, but above meta data key is present there. Also the same is working with revision 1.7.3 without any changes. it's strange behavior. As of now, I have reverted my code to 1.7.3. But any suggestions will be helpful so that features in new versions can be utilized in my application. – Suresh Pal Jan 11 '16 at 09:34
  • Hey Jake, I have seen you used support library 23.0.1 in dependencies. I am using support libs version 22. So is it possible that latest apptentive version is dependent on support libs 23+ version. If so, what is version of apptentive that will work with support libs 22 version. Also if this is the case, the error seems to be misguiding. – Suresh Pal Jan 11 '16 at 09:38
  • Hi Jake, I found this is the case. The latest library works with support library 23+ only. – Suresh Pal Feb 15 '16 at 07:46