Problems with play-services in gradle

Hello,

I was having difficulties to start with backendless in my app. When I called Backendless.initApp(), it crashed.

After some test, I was able to find the problem and make the call initApp not to crash. In my build.graddle, among others, I have compile ‘com.google.android.gms:play-services:8.4.0’. If I removed that line, it worked with no problem.

To solve the problem, now I only use compile ‘com.google.android.gms:play-services-location:8.4.0’ (in fact is better, because I don’t need all play-services modules, just location), but I was wondering what this happend.

Thanks and I just very excited to start with Backendless and see how many things can offer to me, it seems gorgeous!

This is de logcat of the crash:


E/AndroidRuntime: FATAL EXCEPTION: main compile 'com.backendless:backendless:3.0.8.1'
	 java.lang.ExceptionInInitializerError
		 at com.myapp.MainActivity.onCreate(MainActivity.java:60)
		 at android.app.Activity.performCreate(Activity.java:5104)
		 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
		 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
		 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
		 at android.app.ActivityThread.access$600(ActivityThread.java:141)
		 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
		 at android.os.Handler.dispatchMessage(Handler.java:99)
		 at android.os.Looper.loop(Looper.java:137)
		 at android.app.ActivityThread.main(ActivityThread.java:5041)
		 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:793)
		 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
		 at dalvik.system.NativeStart.main(Native Method)
	  Caused by: java.lang.ExceptionInInitializerError
		 at com.backendless.Backendless.<clinit>(Backendless.java:42)
		 at com.myapp.MainActivity.onCreate(MainActivity.java:60) 
		 at android.app.Activity.performCreate(Activity.java:5104) 
		 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 
		 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) 
		 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 
		 at android.app.ActivityThread.access$600(ActivityThread.java:141) 
		 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 
		 at android.os.Handler.dispatchMessage(Handler.java:99) 
		 at android.os.Looper.loop(Looper.java:137) 
		 at android.app.ActivityThread.main(ActivityThread.java:5041) 
		 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:793) 
		 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 
		 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.myapp.MainActivity.onCreate(MainActivity.java:60) 
		 at android.app.Activity.performCreate(Activity.java:5104) 
		 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 
		 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) 
		 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 
		 at android.app.ActivityThread.access$600(ActivityThread.java:141) 
		 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 
		 at android.os.Handler.dispatchMessage(Handler.java:99) 
		 at android.os.Looper.loop(Looper.java:137) 
		 at android.app.ActivityThread.main(ActivityThread.java:5041) 
		 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:793) 
		 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 
		 at dalvik.system.NativeStart.main(Native Method) 

This one is easy to solve.
Do not put the full package play services into gradle file. Rather use only those parts of play services which you need. (E.g. maps/places/gcm…) You find the exact package names on google dev Website.

This is a trouble-some. There appears to be some kind of conflict with com.google.android.gms:play-services:8.4.0. I’ll schedule a ticket to research this.

Thanks!

Hi, Jav!
Just to make clear that the problem is related to Backendless and not to play-services:8.4.0, can you remove Backendless SDK and all Backendless-related code from the project and try again?
Actually, upgrading to play-services:8.4.0 can cause a problem as shown here.
In our LoginWithFacebookSDK sample we use play-services:8.3.0 as a more stable version.
Please check out if it is the Backendless issue, so we can fix it.
Thanks!

This is marked as solved, but I don’t see the solution…

Having the same problem since adding
compile 'com.google.android.gms:play-services:8.4.0’to the gradle file

after changing to 8.3.0, I am receiving this exception when trying to run the app:

java.lang.ExceptionInInitializerError
at com.backendless.Backendless.initApp(Backendless.java:124)
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.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: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)

Hi, Tal.

Can you send us your code so we can reproduce and fix this issue? anatoly.stepanyuk@themidnightcoders.com