2016-01-08 154 views
2

我正在嘗試將Apptentive從1.7.3版本升級到最新的2.1.1版本。 但是每當我調用方法
Apptentive.showMessageCenter(getActivity()),啓動Apptentive消息對話框時,它會崩潰並給ViewActivity NoClassDefFoundError。 日誌是如下:將Apptentive從1.7.3版本升級到2.1.1版本時出現NoClassDefFoundError

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)

我在的build.gradle文件中的代碼是:

compile 'com.apptentive:apptentive-android:[email protected]' 

和Java代碼是:

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()); 
    } 
}); 

相同的代碼正在與1.7.3版本。 有人遇到這個問題或任何人都可以提出什麼問題可以在這裏?

在此先感謝您提出寶貴建議。

+0

發現試圖清理並生成然後重新加載項目 –

+0

即使在清潔它給人的錯誤之後。雖然在1.7.3的工作中,即使沒有任何干淨的構建。 –

回答

3

您可能未在應用的清單中包含對ViewActivity的引用。例如:

<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"/> 

另一種可能性是您沒有在您的build.gradle中引用Apptentive aar。例如:

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:[email protected]' 
} 

更多信息可以在這裏http://www.apptentive.com/docs/android/integration/

+0

嗨傑克,感謝您的迴應,但上面的元數據密鑰在那裏。此外,使用1.7.3修訂版也沒有任何變化。這是奇怪的行爲。截至目前,我已經將我的代碼恢復到1.7.3。但任何建議都會有所幫助,這樣新版本中的功能就可以在我的應用程序中使用。 –

+0

嘿傑克,我看到你在依賴項中使用了支持庫23.0.1。我正在使用支持庫版本22.因此,最新的應用版本可能取決於支持庫版本23+版本。如果是這樣,什麼是與支持庫22版本一起工作的apptentive版本。此外,如果是這種情況,錯誤似乎是錯誤的。 –

+0

嗨傑克,我發現是這樣的。最新的圖書館僅支持庫23+。 –