Hello, community. I've been doing a plugin to discover Google Fitness API. However, i found some problems that i would appreciate your help.
I've already manage to create successfully a GoogleApiClient connected to FitnessAPI, using a Google Account. I've followed the instructions provided for Google for this particular API. The problems began when I tried to query fitness data to the API, getting this error catched w/ adb logcat
07-31 17:23:30.995 28074 28074 W System.err: java.lang.ClassNotFoundException: com.google.android.gms.internal.zzsm$zza
07-31 17:23:30.996 28074 28074 W System.err: at java.lang.Class.classForName(Native Method)
07-31 17:23:30.996 28074 28074 W System.err: at java.lang.BootClassLoader.findClass(ClassLoader.java:1346)
07-31 17:23:30.996 28074 28074 W System.err: at java.lang.BootClassLoader.loadClass(ClassLoader.java:1406)
07-31 17:23:30.996 28074 28074 W System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
07-31 17:23:30.996 28074 28074 W System.err: at com.tns.Runtime.getTypeMetadata(Runtime.java:614)
07-31 17:23:30.996 28074 28074 W System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
07-31 17:23:30.996 28074 28074 W System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1021)
07-31 17:23:30.996 28074 28074 W System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:903)
07-31 17:23:30.996 28074 28074 W System.err: at com.tns.Runtime.callJSMethod(Runtime.java:890)
07-31 17:23:30.996 28074 28074 W System.err: at com.tns.Runtime.callJSMethod(Runtime.java:874)
07-31 17:23:30.996 28074 28074 W System.err: at com.tns.Runtime.callJSMethod(Runtime.java:866)
07-31 17:23:30.996 28074 28074 W System.err: at com.tns.gen.com.google.android.gms.common.api.GoogleApiClient_ConnectionCallbacks.onConnected(GoogleApiClient_ConnectionCallbacks.java:11)
07-31 17:23:30.997 28074 28074 W System.err: at com.google.android.gms.common.internal.zzl.zzo(Unknown Source)
07-31 17:23:30.997 28074 28074 W System.err: at com.google.android.gms.internal.zzpy.zzm(Unknown Source)
07-31 17:23:30.997 28074 28074 W System.err: at com.google.android.gms.internal.zzpw.zzapp(Unknown Source)
07-31 17:23:30.997 28074 28074 W System.err: at com.google.android.gms.internal.zzpw.onConnected(Unknown Source)
07-31 17:23:30.997 28074 28074 W System.err: at com.google.android.gms.internal.zzqa.onConnected(Unknown Source)
07-31 17:23:30.997 28074 28074 W System.err: at com.google.android.gms.internal.zzpp.onConnected(Unknown Source)
07-31 17:23:30.997 28074 28074 W System.err: at com.google.android.gms.common.internal.zzk$1.onConnected(Unknown Source)
07-31 17:23:30.997 28074 28074 W System.err: at com.google.android.gms.common.internal.zzd$zzj.zzasd(Unknown Source)
07-31 17:23:30.997 28074 28074 W System.err: at com.google.android.gms.common.internal.zzd$zza.zzc(Unknown Source)
07-31 17:23:30.997 28074 28074 W System.err: at com.google.android.gms.common.internal.zzd$zza.zzv(Unknown Source)
07-31 17:23:30.997 28074 28074 W System.err: at com.google.android.gms.common.internal.zzd$zze.zzasf(Unknown Source)
07-31 17:23:30.997 28074 28074 W System.err: at com.google.android.gms.common.internal.zzd$zzd.handleMessage(Unknown Source)
07-31 17:23:30.997 28074 28074 W System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
07-31 17:23:30.997 28074 28074 W System.err: at android.os.Looper.loop(Looper.java:154)
07-31 17:23:30.997 28074 28074 W System.err: at android.app.ActivityThread.main(ActivityThread.java:6126)
07-31 17:23:30.997 28074 28074 W System.err: at java.lang.reflect.Method.invoke(Native Method)
07-31 17:23:30.997 28074 28074 W System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
07-31 17:23:30.997 28074 28074 W System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
07-31 17:23:30.998 28074 28074 W System.err: Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
When i tried to look for solution, i realized it might be a problem in some google services dependencies and i tried everything i could, w/out any success. Finally, after huge turnarounds, i find this when i run npm run demo.android
:compileF0F1DebugSources
:buildMetadata
Skip com.google.android.gms.internal.zzt
Error: java.lang.NullPointerException
Skip com.google.android.gms.internal.zzw
Error: java.lang.NullPointerException
Skip com.google.android.gms.internal.zzy
Error: java.lang.NullPointerException
Skip com.google.android.gms.internal.zzz
Error: java.lang.NullPointerException
I'm running Nativescript 3.1.2 w/ tns-core-modules 3.1.0 and tns-android 3.1.0. I've Google Play Services version 43 installed in AndroidSDK. I leave my include.gradle down here
android {
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
"nativescript-google-fit" {
dimension "nativescript-google-fit"
}
}
}
dependencies {
compile 'com.google.android.gms:play-services-base:9.4.0'
compile 'com.google.android.gms:play-services-fitness:9.4.0'
}
Feel free to clone my repo and give me some precious advice.
Hey @filipemendes1994, is there a particular reason you put a proguard configuration here? A nested, likely private class is missing, according to the log. A possible reason for that is the class being referenced and used in JavaScript, is cleaned up and removed by ProGuard.
@Pip3r4o i checked my proguard twice and I didn't realized where I could be removing that library, but be free to check. Also, I tried to comment the proguard configuration and the problem remain the same.
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}
-keepnames class * implements android.os.Parcelable
-keepclassmembers class * implements android.os.Parcelable {
public static final *** CREATOR;
}
-keep @interface android.support.annotation.Keep
-keep @android.support.annotation.Keep class *
-keepclasseswithmembers class * {
@android.support.annotation.Keep <fields>;
}
-keepclasseswithmembers class * {
@android.support.annotation.Keep <methods>;
}
-keep @interface com.google.android.gms.common.annotation.KeepName
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
-keep @interface com.google.android.gms.common.util.DynamiteApi
-keep public @com.google.android.gms.common.util.DynamiteApi class * {
public <fields>;
public <methods>;
}
-dontwarn android.security.NetworkSecurityPolicy
I think that I copy-and-paste the proguard configuration from Android Google API Fitness Sample
@filipemendes1994 a repro sample would be much appreciated so we can troubleshoot the problem.
@Pip3r4o the problem remains but it is not critical. The exception throws every first time I invoke that method but the plugin stills running. If you want to see, check this repo and execute tns run demo.ng.android.
@filipemendes1994 do you still have the above problem, as I tried with the provided repo but couldn't reproduce it?
Closing issue due to inactivity.
Please let us know if the original issue persists, or think the issue should be opened again.