Cannot add backendless through gradle

hey guys,
I added this line in build.gradle:

compile ‘com.backendless:android:3.0.8.1’ receiving an error message “Failed to resolve:com.backendless:android:3.0.8.1”
cheers,Tal

The declaration is wrong, here’s the right way to add it:

dependencies {
    compile 'com.backendless:backendless:3.0.8.1'
}

Hey mark

I changed this, but now I get this exception on this line from the Application class onCreate:
Backendless.initApp(this, Consts.BACKENDLESS_APP_ID, Consts.BACKENDLESS_SECRET_KEY, version);

java.lang.ExceptionInInitializerError
at com.taldroid.apps.tapextreme.TapExtremeApplication.onCreate(TapExtremeApplication.java:25)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1017)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4579)
at android.app.ActivityThread.access$1400(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5306)
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:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ExceptionInInitializerError
at com.backendless.Backendless.<clinit>(Backendless.java:42)
at com.taldroid.apps.tapextreme.TapExtremeApplication.onCreate(TapExtremeApplication.java:25)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1017)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4579)
at android.app.ActivityThread.access$1400(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5306)
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:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: weborb.types.Types
at com.backendless.UserService.<init>(UserService.java:56)
at com.backendless.UserService.<clinit>(UserService.java:47)
at com.backendless.Backendless.<clinit>(Backendless.java:42)
at com.taldroid.apps.tapextreme.TapExtremeApplication.onCreate(TapExtremeApplication.java:25)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1017)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4579)
at android.app.ActivityThread.access$1400(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5306)
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:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)

Hi, Tal

Does your code look like this?

public class TapExtremeApplication extends Application{

    @Override
    public void onCreate() {
        super.onCreate();

        Backendless.initApp(this, Consts.BACKENDLESS_APP_ID, Consts.BACKENDLESS_SECRET_KEY, "v1");

Yes, only with facebookSDK init also:

public class TapExtremeApplication extends Application{
@Override
public void onCreate() {
super.onCreate(); FacebookSdk.sdkInitialize(getApplicationContext()); String version = “v1”;

Backendless.initApp(this, Consts.BACKENDLESS_APP_ID, Consts.BACKENDLESS_SECRET_KEY, version);

I have just tried the code you sent a week before and everything works fine. Please send your project again to support@backendless.com

Hey arthur,
Yes, but this is the code with the latest release.
Plus, google play services.

I shared the zip with you,

Thanks,
Tal

I have successfully started the application, here is login activity that appeared to me.
The only thing: on the first time application failed with OOM error but I have fixed it by adding android:largeHeap="true" to manifest.

Try putting Backendless.initApp at the first line of method and passing getApplicationContext() instead of this.

Backendless.initApp(getApplicationContext(), Consts.BACKENDLESS_APP_ID, Consts.BACKENDLESS_SECRET_KEY, version); 

http://imgur.com/mNRKU4I

Hey arthur, good to se that it’s working for you. still not working for me though haha

i’ve done your changes, also tried compile ‘com.google.android.gms:play-services:8.3.0’ instead of 8.4.0.

still getting an exception in the initialization…

java.lang.ExceptionInInitializerError
at com.backendless.Backendless.initApp(Backendless.java:124)
at com.taldroid.apps.tapextreme.TapExtremeApplication.onCreate(TapExtremeApplication.java:19)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1017)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4579)
at android.app.ActivityThread.access$1400(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5306)
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:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: weborb.writer.specialized.TypedDictionary
at weborb.writer.MessageWriter.initWriters(MessageWriter.java:131)
at weborb.writer.MessageWriter.<clinit>(MessageWriter.java:64)
at com.backendless.Backendless.initApp(Backendless.java:124)
at com.taldroid.apps.tapextreme.TapExtremeApplication.onCreate(TapExtremeApplication.java:19)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1017)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4579)
at android.app.ActivityThread.access$1400(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5306)
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:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)

Tal,

What version of Android do you build this with?
What version of Android Studio do you use?

Mark

Hi Tal, if I were you I would create an empty project and try to do Backendless stuff there. If things go wrong then the problem is in Backendless and we fix it, but in other case there is something wrong in other libs/code you add.

Ok. mystery solved.

It happened when I added more dependencies. and it’s a dex issue.
I found the solution here:

I am very glad to hear you got things working.