我在我的Android Mobile應用程序中使用Liferay屏幕以及Liferay Android Mobile SDK。 我已將LoginScreenlet放入我的活動中。它顯示正常,但是當我點擊登錄按鈕,我得到這個錯誤:Liferay Screens中的NoClassDefError com.liferay.mobile.screens.base.interactor.JSONObjectCallback Android
05-08 10:58:37.681 9296-9296/com.mimacom.lrhc E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.liferay.mobile.screens.base.interactor.JSONObjectCallback
at com.liferay.mobile.screens.auth.login.interactor.LoginBasicInteractor.getUserService(LoginBasicInteractor.java:68)
at com.liferay.mobile.screens.auth.login.interactor.LoginBasicInteractor.login(LoginBasicInteractor.java:37)
at com.liferay.mobile.screens.auth.login.LoginScreenlet.onUserAction(LoginScreenlet.java:236)
at com.liferay.mobile.screens.auth.login.LoginScreenlet.onUserAction(LoginScreenlet.java:44)
at com.liferay.mobile.screens.base.BaseScreenlet.performUserAction(BaseScreenlet.java:78)
at com.liferay.mobile.screens.viewsets.defaultviews.auth.login.LoginView.onClick(LoginView.java:136)
at android.view.View.performClick(View.java:4084)
at android.view.View$PerformClick.run(View.java:16966)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
我對Genymotion模擬器嘗試此,安卓4.1.1(等級16)。
我的應用程序的文件的gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.jakewharton.hugo'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.mimacom.lrhc"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility "1.7"
targetCompatibility "1.7"
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
mock {}
prod {}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
//Support libraries
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:support-annotations:23.3.0'
//RxJava
compile 'io.reactivex:rxandroid:1.1.0'
compile 'io.reactivex:rxjava:1.1.3'
//Butterknife view injection
compile 'com.jakewharton:butterknife:8.0.1'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
//Dagger dependency injection
apt 'com.google.dagger:dagger-compiler:2.2'
compile 'com.google.dagger:dagger:2.2'
provided 'javax.annotation:jsr250-api:1.0'
//Memory leak detector
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
//Liferay SDK and Screens
compile group: 'com.liferay.mobile', name: 'liferay-android-sdk', version: '6.2.0.22'
compile 'com.liferay.mobile:liferay-screens:1.3.0'
compile 'com.liferay.mobile:liferay-material-viewset:1.3.0'
}
我發現一個論壇帖子有關類似問題,不過那是舊版本的Liferay屏幕。我猜1.3.0應該已經兼容了。 https://web.liferay.com/community/forums/-/message_boards/message/60438799
這確實是一個依賴性問題還是其他的東西?
感謝後。但是,我會再建議更新此頁:https://github.com/liferay/liferay-mobile-sdk/blob/master/android/README.md,因爲我在我的gradle構建文件中使用了該版本,並得到了6.x版本,這給我帶來了麻煩。 –