I made the simplest example indicated in the quick start guide and I’m having problems to execute it:
This is the code added in Main_activity.java:
String appVersion = "v1";
String application_id = "*****************";
String secret_key = "*****************";
Backendless.initApp(this, application_id, secret_key, appVersion);
BackendlessUser user = new BackendlessUser();
user.setEmail("*********@***.***");
user.setPassword("*********");
Backendless.UserService.register(user, new BackendlessCallback<BackendlessUser>() {
@Override
public void handleResponse(BackendlessUser backendlessUser) {
Log.i("Registration", backendlessUser.getEmail() + " successfully registered");
}
@Override
public void handleFault(BackendlessFault fault) {
Log.d(TAG, fault.toString());
}
});
When using Backendless 3.0.6:
compile ‘com.backendless:android:3.0.6’
I get this error:
FATAL EXCEPTION: main
, PID: 28400
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/backendless/BackendlessCollection;
at com.backendless.Persistence.<init>(Persistence.java:72)
at com.backendless.Persistence.<clinit>(Persistence.java:62)
at com.backendless.Persistence.getInstance(Persistence.java:66)
at com.backendless.Backendless.<clinit>(Backendless.java:43)
at com.backendless.Backendless.initApp(Backendless.java:111)
at es.quizit.activities.Main_activity.onCreate(Main_activity.java:80)
at android.app.Activity.performCreate(Activity.java:6664)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.ClassNotFoundException: com.backendless.BackendlessCollection
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:742)
at java.lang.ClassLoader.loadClass(ClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.backendless.Persistence.<init>(Persistence.java:72)
at com.backendless.Persistence.<clinit>(Persistence.java:62)
at com.backendless.Persistence.getInstance(Persistence.java:66)
at com.backendless.Backendless.<clinit>(Backendless.java:43)
at com.backendless.Backendless.initApp(Backendless.java:111)
at es.quizit.activities.Main_activity.onCreate(Main_activity.java:80)
at android.app.Activity.performCreate(Activity.java:6664)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/backendless/commons/AbstractBackendlessCollection;
at com.backendless.Persistence.<init>(Persistence.java:72)
at com.backendless.Persistence.<clinit>(Persistence.java:62)
at com.backendless.Persistence.getInstance(Persistence.java:66)
at com.backendless.Backendless.<clinit>(Backendless.java:43)
at com.backendless.Backendless.initApp(Backendless.java:111)
at es.quizit.activities.Main_activity.onCreate(Main_activity.java:80)
at android.app.Activity.performCreate(Activity.java:6664)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.ClassNotFoundException: Didn’t find class “com.backendless.commons.AbstractBackendlessCollection” on path: DexPathList[[zip file "/data/app/com.-2/base.apk"],nativeLibraryDirectories=[/data/app/com.-2/lib/x86, /data/app/com.-2/base.apk!/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.backendless.Persistence.<init>(Persistence.java:72)
at com.backendless.Persistence.<clinit>(Persistence.java:62)
at com.backendless.Persistence.getInstance(Persistence.java:66)
at com.backendless.Backendless.<clinit>(Backendless.java:43)
at com.backendless.Backendless.initApp(Backendless.java:111)
at es.quizit.activities.Main_activity.onCreate(Main_activity.java:80)
at android.app.Activity.performCreate(Activity.java:6664)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
And if I try to use compile ‘com.backendless:backendless:4.0.0-beta1’
I get this other error in logcat:
D/Main_activity: BackendlessFault{ code: ‘Internal client exception’, message: ‘https://api.backendless.com/MY-APPLICATION-ID/MY-SECRET-KEY/binary’ }
03-23 14:40:45.148 509-514/com.*
I have obviously changed my two keys in the previous error for words that mean the values throwns by the error.
If I don’t handle the error, I get this stack error:
FATAL EXCEPTION: main
Process: com.********, PID: 3346
java.lang.RuntimeException: https://api.backendless.com/MY-APPLICATION-ID/MY-SECRET-KEY/binary
at com.backendless.async.callback.BackendlessCallback.handleFault(BackendlessCallback.java:28)
at com.backendless.UserService$1.handleFault(UserService.java:116)
at com.backendless.async.message.AsyncMessage$FaultHandler.handle(AsyncMessage.java:83)
at com.backendless.async.message.AsyncMessage.handleCallback(AsyncMessage.java:41)
at com.backendless.core.AndroidCarrier$1.handleMessage(AndroidCarrier.java:37)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Any help would be appreciated. Probably the Android samples need to be updated to Android Studio and Gradle so we could leverage them. Thank you
My apologies for the formatting of the question. I had problems with the editor.