caffeinalab / ti.goosh

GCM/FCM module for Titanium.
MIT License
52 stars 34 forks source link

java.lang.NoClassDefFoundError #76

Closed jcsomac closed 6 years ago

jcsomac commented 6 years ago

Hi guys. i was using this module for Android notifications, and everything works fine, but couple days ago, i upload the app in the Google Play Store and the app just does not start. It stuck in the Splashscreens. Then i go to the developer console and find out the error.

java.lang.NoClassDefFoundError: at ti.goosh.IntentService.parseNotification (IntentService.java:96) at ti.goosh.IntentService.onMessageReceived (IntentService.java:54) at com.google.android.gms.gcm.GcmListenerService.zzq (Unknown Source) at com.google.android.gms.gcm.GcmListenerService.zzp (Unknown Source) at com.google.android.gms.gcm.GcmListenerService.zzo (Unknown Source) at com.google.android.gms.gcm.GcmListenerService.zza (Unknown Source) at com.google.android.gms.gcm.GcmListenerService$1.run (Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:588) at java.lang.Thread.run (Thread.java:818) Caused by: java.lang.ClassNotFoundException: at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass (ClassLoader.java:511) at java.lang.ClassLoader.loadClass (ClassLoader.java:469)

In all the test made to te app works fine, works perfectly. This is my code:

Before the main window is opened i do this:

 if( Ti.Platform.osname=='android' ){  
   ObtenerPushAndroid( self );   
 }
 else{
   registerForPush();
 }

And the function obtenerPushAndroid is:

   function ObtenerPushAndroid( self ){
         TiGoosh = require("ti.goosh");
         TiGoosh.cancelAll();
         TiGoosh.registerForPushNotifications({
            success: function(e) {
                var token = e.deviceToken;
                Ti.API.log('Notifications: device token is ' + token );
                Utiles.RegistrarEnServidor( token );
            },
            error: function(err) {
                Ti.API.error('Notifications: Retrieve device token failed', err);
            },
            callback: function(e){     
                var data   = JSON.parse(e.data || ''); 
                var extra1 = data.data.extra1;
                var extra2 = data.data.extra2;
                var extra3 = data.data.extra3;
                var texto  = data.alert;
                Ti.API.info("*** Aca llega la notificacion");
                TiGoosh.cancelAll();
                if(Utiles.obtenerOpcion("conexion_tipo")==params.TIPO_LAVADOR){
                             if(extra1=="CANCELADO"){
                              if(extra2==Utiles.obtenerOpcion("id_servicio")){
                                  Utiles.grabarOpcion("buscar_lavador","S");
                       Utiles.grabarOpcion("en_servicio","N");
                       Utiles.grabarOpcion("id_servicio","0");
                       Utiles.grabarOpcion("latitud_servicio","");
                       Utiles.grabarOpcion("longitud_servicio","");
                       Utiles.grabarOpcion("llegada_domicilio","N"); 
                       Utiles.grabarOpcion("inicio_lavado","N"); 
                       Utiles.grabarOpcion("fin_lavado","N");                         
                       Utiles.grabarOpcion("latitud_lavador","");
                       Utiles.grabarOpcion("longitud_lavador","");              
                                  Utiles.Alerta("El servicio que estabas atendiendo fue cancelado de manera repentina por el usuario");
                                  self.fireEvent("focus");
                                  TiGoosh.cancelAll();
                              }
                             }
                             else{
                              var alertaServicio = require("src/vistas/ventana_servicio");
                               alertaServicio.Mostrar( self, extra1, texto );
                               TiGoosh.cancelAll();
                             }             
                }
                // Usuario
                Ti.API.info("*** D");
                            if(Utiles.obtenerOpcion("conexion_tipo")==params.TIPO_USUARIO ) {
                             Ti.API.info("*** E");
                             if(extra1=="ACCIONLAVADOR") {
                              Ti.API.info("*** F");
                              if(extra2=="CANCELADO"){
                                Ti.API.info("*** G");
                       Utiles.grabarOpcion("en_servicio","N"); 
                       Utiles.grabarOpcion("estatus_servicio","");
                       Utiles.grabarOpcion("buscar_lavador","S");    
                       self.fireEvent("focus");             
                              }
                              Ti.API.info("*** H");
                              if(extra2=="FINSERVICIO"){
                                Ti.API.info("*** I");
                       Utiles.grabarOpcion("en_servicio","N"); 
                       Utiles.grabarOpcion("estatus_servicio","");
                       Utiles.grabarOpcion("buscar_lavador","S");                 
                       self.fireEvent("focus");   
                       var calificar = require("src/vistas/calificar");
                                  calificar.Mostrar( extra3 );          
                              }
                              else{
                                Ti.API.info("*** J");
                                 Utiles.Alerta(texto) ;
                              }
                             }
                            }
            }           
        });  
  } 

What am i doing wrong ? or what else can be ? Thanks in advance..

progress44 commented 6 years ago

Did you include the google play services jar? The error states that some classes are missing and the only thing I can think of right now is the gps jar

progress44 commented 6 years ago

Try the new release of ti.goosh (version 3.0.0) Make sure to include only the Google Play Libraries that are needed and that there aren't any duplicates. For example if, ti.goosh/3.0.0/lib contains play-services-base make sure it is not present in ti.map/xx/lib