Suresh Pal
Suresh Pal

Reputation: 21

NoClassDefFoundError when upgrading Apptentive from version 1.7.3 version to 2.1.1 version

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.

Upvotes: 2

Views: 140

Answers (1)

Jake
Jake

Reputation: 271

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/

Upvotes: 3

Related Questions