hansemannn / titanium-firebase-analytics

Use the Firebase Analytics SDK in Axway Titanium 🚀
Other
35 stars 18 forks source link

Phones without Google Play Services #54

Closed knemeth-vidatec closed 3 years ago

knemeth-vidatec commented 4 years ago

Hi guys,

my app is crashing with:

[ERROR] TiExceptionHandler: (main) [1,899] Unable to instantiate service com.google.android.gms.measurement.AppMeasurementService: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.measurement.AppMeasurementService" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/uk.co.uktv.dave-oaDwSe_2k_mJYdhb3BBh6Q==/base.apk"],nativeLibraryDirectories=[/data/app/uk.co.uktv.dave-oaDwSe_2k_mJYdhb3BBh6Q==/lib/x86, /data/app/uk.co.uktv.dave-oaDwSe_2k_mJYdhb3BBh6Q==/base.apk!/lib/x86, /system/lib]] [ERROR] TiExceptionHandler: [ERROR] TiExceptionHandler: dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134) [ERROR] TiExceptionHandler: java.lang.ClassLoader.loadClass(ClassLoader.java:379) [ERROR] TiExceptionHandler: java.lang.ClassLoader.loadClass(ClassLoader.java:312) [ERROR] TiExceptionHandler: android.app.AppComponentFactory.instantiateService(AppComponentFactory.java:103) [ERROR] TiExceptionHandler: android.app.ActivityThread.handleCreateService(ActivityThread.java:3514) [ERROR] TiExceptionHandler: android.app.ActivityThread.access$1300(ActivityThread.java:199) [ERROR] TiExceptionHandler: android.app.ActivityThread$H.handleMessage(ActivityThread.java:1666) [ERROR] TiExceptionHandler: android.os.Handler.dispatchMessage(Handler.java:106) [ERROR] TiExceptionHandler: android.os.Looper.loop(Looper.java:193) [ERROR] TiExceptionHandler: android.app.ActivityThread.main(ActivityThread.java:6669) [ERROR] TiExceptionHandler: java.lang.reflect.Method.invoke(Native Method) [ERROR] TiExceptionHandler: com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) [ERROR] TiExceptionHandler: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) [ERROR] FirebaseInstanceId: Google Play services missing or without correct permission. [ERROR] FirebaseInstanceId: Google Play services missing or without correct permission.

bcoz of my tiapp.xml settings:

        <service android:name="com.google.android.gms.measurement.AppMeasurementJobService" android:permission="android.permission.BIND_JOB_SERVICE" android:enabled="true" android:exported="false" />

        <receiver android:name="com.google.android.gms.measurement.AppMeasurementReceiver" android:enabled="true">
           <intent-filter>
              <action android:name="com.google.android.gms.measurement.UPLOAD" />
           </intent-filter>
        </receiver>  

I only include firebase modules when there is Google Play Services available.

if (OS_ANDROID) { const playServices = require('ti.playservices'); playServicesAvailable = playServices.isGooglePlayServicesAvailable(); // return ConnectionResult: SUCCESS=0, SERVICE_MISSING, SERVICE_UPDATING, SERVICE_VERSION_UPDATE_REQUIRED, SERVICE_DISABLED, SERVICE_INVALID=9

if (playServicesAvailable == 0) { analyticsEnabled = true; var FirebaseCore = require('firebase.core'); var FirebaseAnalytics = require('firebase.analytics');

} }

is there any work around to sort out my problem?

Thanks

hansemannn commented 3 years ago

You have to use device-dependent conditions (e.g. for Huawei) to bridge out the Firebase / GPS components