How can I run Google Fit Sample? - android

I downloaded the sample at https://github.com/googlesamples/android-fit
and Build a Project [StepCouter] is ok.
But when I run on my device, an error occured:
02-27 16:37:18.620 26622-26622/com.google.android.gms.fit.samples.stepcounter E/dalvikvm:
Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
02-27 16:37:18.660 26622-26622/com.google.android.gms.fit.samples.stepcounter E/AndroidRuntime:
FATAL EXCEPTION: main
java.lang.NoSuchMethodError: com.google.android.gms.fit.samples.common.logger.LogView.setTextAppearance
at com.google.android.gms.fit.samples.stepcounter.MainActivity.initializeLogging(MainActivity.java:161)
at com.google.android.gms.fit.samples.stepcounter.MainActivity.onCreate(MainActivity.java:57)
at android.app.Activity.performCreate(Activity.java:5111)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2185)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
at android.app.ActivityThread.access$700(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1269)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5159)
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:810)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:577)
at dalvik.system.NativeStart.main(Native Method)
How can I fix this error?
Thanks all.

Make sure that you have the right permissions and scopes. You may follow this documentation on how to obtain authorization in Google Fit API.
User consent is always required before your app can read or write fitness data. To obtain authorization:
Register your Android app with a project in the Google Developers Console.
Specify a scope of access when connecting to the fitness service.
In Google Fit, scopes are strings that determine what kinds of fitness data an app can access and the level of access to this data.
For the Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering error, you may refer with this link.

Related

Unable to extract the trust manager on a.a.k#... - PayPal-Android-SDK 2.13.3

I recently updated my Song Scrapbook app to the latest version and also made sure to update all third-party APIs used by the app. One such third-party tool is the PayPal Android SDK which I use to monetize my app since I live in a country where the Google Wallet Merchant service is currently not supported - which means I cannot use the Play Store in-app or once-off purchase systems in my app.
However, after updating the PayPal SDK to the latest version in my app (via mavenCentral) I get the following error in Android Studio (version: 1.5.1) everytime I want to execute a PayPal transaction:
debug W/paypal.sdk: PayPalService created. API:19 PayPalSDK/PayPal-Android-SDK 2.13.3 (Android 4.4.4; samsung GT-I9060I; )
03-20 16:58:45.540 7804-7804/com.whitsoft.songscrapbook.debug W/ApplicationPackageManager: getCSCPackageItemText()
03-20 16:58:45.550 7804-7804/com.whitsoft.songscrapbook.debug W/ApplicationPackageManager: getCSCPackageItemText()
03-20 16:58:45.550 7804-7804/com.whitsoft.songscrapbook.debug I/dalvikvm: Could not find method com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable, referenced from method com.paypal.android.sdk.at.a
03-20 16:58:45.550 7804-7804/com.whitsoft.songscrapbook.debug W/dalvikvm: VFY: unable to resolve static method 10405: Lcom/google/android/gms/common/GooglePlayServicesUtil;.isGooglePlayServicesAvailable (Landroid/content/Context;)I
03-20 16:58:45.610 7804-7804/com.whitsoft.songscrapbook.debug I/dalvikvm: Could not find method io.card.payment.CardIOActivity.checkSelfPermission, referenced from method io.card.payment.CardIOActivity.onCreate
03-20 16:58:45.610 7804-7804/com.whitsoft.songscrapbook.debug W/dalvikvm: VFY: unable to resolve virtual method 13172: Lio/card/payment/CardIOActivity;.checkSelfPermission (Ljava/lang/String;)I
03-20 16:58:45.820 7804-7843/com.whitsoft.songscrapbook.debug I/System: Loaded time zone names for "en" in 132ms (127ms in ICU)
03-20 16:58:45.840 7804-7804/com.whitsoft.songscrapbook.debug W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x4168cbc0)
03-20 16:58:45.840 7804-7804/com.whitsoft.songscrapbook.debug E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.whitsoft.songscrapbook.debug, PID: 7804
java.lang.RuntimeException: Unable to start service com.paypal.android.sdk.payments.PayPalService#41e9c5a0 with Intent { cmp=com.whitsoft.songscrapbook.debug/com.paypal.android.sdk.payments.PayPalService (has extras) }: java.lang.IllegalStateException: Unable to extract the trust manager on a.a.k#41ff61a0, sslSocketFactory is class com.paypal.android.sdk.bn
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2987)
at android.app.ActivityThread.access$2100(ActivityThread.java:166)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1380)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5584)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: Unable to extract the trust manager on a.a.k#41ff61a0, sslSocketFactory is class com.paypal.android.sdk.bn
at a.ak.<init>(Unknown Source)
at a.ak.<init>(Unknown Source)
at a.am.b(Unknown Source)
at com.paypal.android.sdk.bt.<init>(Unknown Source)
at com.paypal.android.sdk.payments.PayPalService.a(Unknown Source)
at com.paypal.android.sdk.payments.PayPalService.onStartCommand(Unknown Source)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2970)
at android.app.ActivityThread.access$2100(ActivityThread.java:166) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1380) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5584) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084) 
at dalvik.system.NativeStart.main(Native Method) 
03-20 17:03:46.103 7804-7804/? I/Process: Sending signal. PID: 7804 SIG: 9
I know this problem is not caused by the device on which I tested the app - as I have tested this app on two very different devices (Samsung Grand Neo and Cubot X15) and both devices produced similar errors. I tried googling the problem to try and solve the problem but after hours of searching found no solution.
Any assistance will be much appreciated.
SilSur.
So it took me roughly 5 hours to figure this one out - which I achieved through a step-by-step elimination of possible causes of the problem.
Turns out the real problem was my haste in trying to update the app. The reason being that the PayPal SDK 2.13.3 version has a new rule in the 'proguard-rules.pro' file that is very important to include:
Rule as follows:
# This is added for okhttp 3.1.2 bug fix as shown at https://github.com/square/okhttp/issues/2323
-keepclassmembers class * implements javax.net.ssl.SSLSocketFactory {
private javax.net.ssl.SSLSocketFactory delegate;
}
This prevents the minify (obfuscation) process of Gradle from removing IMPORTANT code from a previous bug-fix in the PayPal SDK that caused problems with the secure layer socket factory. So yeah - that was the fix: the updated app now works perfectly (just as required).
Lesson learnt: make sure your 'proguard-rules' are exactly as they are suppose to be!
Over & Out, SilSur.

Rare Android Unable to Instantiate Application Exception

I'm seeing the following exception under Crashes in the dev console from time to time.
Whats puzzling about it is that google maps shows up in the call stack as if its calling or creating my app class - very confusing. Whats further weird is the "MyApp-2.apk" in the call stack - where it appends the "-2".
I do include the android.maps.jar file in the libs.
I would like to know how to recreate this if possible and how to prevent this from happening?
java.lang.RuntimeException: Unable to instantiate application com.MyApp.MyCustomApp:
java.lang.ClassNotFoundException: Didn't find class "com.MyApp.MyCustomApp"
on path: /system/framework/com.google.android.maps.jar:/data/app/com.MyApp-2.apk
at android.app.LoadedApk.makeApplication(LoadedApk.java:503)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4405)
at android.app.ActivityThread.access$1400(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1327)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5059)
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:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.MyApp.MyCustomApp" on path: /system/framework/com.google.android.maps.jar:/data/app/com.MyApp-2.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newApplication(Instrumentation.java:967)
at android.app.LoadedApk.makeApplication(LoadedApk.java:498)
... 11 more
Manifest Application Tag:
<application
android:name=".MyApp"
android:hardwareAccelerated="true"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:theme="#style/AppBaseTheme" >
I'm using these JARS: android-support-v4-r2-googlemaps.jar + android-support-v4.jar
The prime reason why a Class within your application would be present on your test devices but missing at runtime on some others would be if your class has a dependency on some external feature which is missing on those devices. For example, if you used some Google API which is not part of AOSP and so missing on a plain AOSP build, or a vendor build which does not license these, then your class will be pruned at install time as its dependencies cannot be resolved.
A common reason for your app finding its way into such circumstances might be someone running an inconsistently assembled "custom ROM" on their device.

First time Google Map API

I am a first time Android Studio user, trying to get the Google Map app to run from the samples provided. Android-Studio is running on a Gentoo Linux platform, using Java 8. I have followed the directions on how to add Google Play services, added the definition to Gradle, far as I can tell it is the virtual device that does not have Google play service support. I have also added pro-guard rules, error is always the same. The build rules and dependencies have the entries from the documentation. It looks like it should work.
It is obvious that I am missing something basic. The basic HelloWorld works fine, I am stumbling on Google's security and the mechanism by which they are invoked. Reviewing the documentation, I see references to GoogleAPIClient -- Do I have to setup the client connection before trying to connect? Is there, perhaps sample code where this process is defined correctly, with all its pieces?
The studio itself is at current revision levels. From the error, is it possible I have missed something else, the ActivityNotFound exception?
The LogCat message stream
09-10 10:07:16.449 1006-1006/cx.ath.klatt.test1 E/AndroidRuntime﹕ FATAL EXCEPTION: main
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.google.android.gms flg=0x80000 pkg=com.android.vending }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1622)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
at android.app.Activity.startActivityForResult(Activity.java:3370)
at android.app.Activity.startActivityForResult(Activity.java:3331)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:840)
at android.app.Activity.startActivity(Activity.java:3566)
at android.app.Activity.startActivity(Activity.java:3534)
at com.google.android.gms.dynamic.a$5.onClick(Unknown Source)
at android.view.View.performClick(View.java:4204)
at android.view.View$PerformClick.run(View.java:17355)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
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)
09-10 10:07:18.929 1006-1006/cx.ath.klatt.test1 I/Process﹕ Sending signal. PID: 1006 SIG: 9
09-10 10:07:47.989 1035-1035/cx.ath.klatt.test1 W/GooglePlayServicesUtil﹕ Google Play services is missing.
The device in which you are installing, the google play services need to be installed and need to be up to date also.

What could be causing a ClassNotFoundException?

So I've been working on an app lately which runs fine on most devices. However, sometimes the app crashes at start up with the following error:
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{com.mypackage.app/com.mypackage.app.activities.MainPager}:
java.lang.ClassNotFoundException: com.mypackage.app.activities.MainPager
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1995)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2096)
at android.app.ActivityThread.access$600(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1207)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4787)
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:809)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:115)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException:
com.mypackage.app.activities.MainPager
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1986)
... 12 more
I get that this is because it can't find the class called MainPager. But how is that even possible? I mean, the class should be there.. I put it there myself :) . Why on earth is it not finding it?
EDIT: I think the cause may be that in my manifest I have android:package="com.mypackage.app" defined, but that my launch activity is in the package com.mypackage.app.activities. Currently testing this theory. Still weird that it only happens on some devices, though.
This solution won't work, since I then can't update the APK in Google Play (has to be the same package name in the manifest).
Since ADT update to revision 22 (May 2013) you have to check "Android Private Libraries" check box in Project -> Properties -> Java Build Path -> Order and Export in Eclipse for your older projects to get rid of this exception ...
in the manifest you add Activity name like this
android:name=".activities.MainPager"
because you have given package name
android:package="com.mypackage.app"
Now I am using ART runtime on Nexus 5, and I am getting ClassNotFound for some apps.
You can safely ignore those if that's the case for your users.

Android force-close on Google maps: java.lang.NoSuchFieldException: loading_tile_android

One of my Android users is getting a force-close when launching Google Map (MapActivity class) inside my application. He gets a MissingResourceException. He's the only one complaining so far, and he is using Vanilla Tazz phone. The Google maps application itself works well on his device. It looks like it's something specific to Vanilla Tazz. I tried to find a fix online but have not been successful. Here's the Android error log:
java.lang.ExceptionInInitializerError
at ...
at android.view.View.performClick(View.java:2449)
at android.view.View$PerformClick.run(View.java:9027)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ExceptionInInitializerError
at com.google.android.maps.MapActivity.<clinit>(MapActivity.java:295)
... 14 more
Caused by: java.util.MissingResourceException: Could not find required resource
com.android.internal.R$drawable.loading_tile_android (java.lang.NoSuchFieldException: loading_tile_android)
at com.google.android.maps.InternalR.getField(InternalR.java:65)
at com.google.android.maps.InternalR.get(InternalR.java:39)
at com.google.android.maps.InternalR.access$000(InternalR.java:28)
at com.google.android.maps.InternalR$drawable.get(InternalR.java:112)
at com.google.android.maps.InternalR$drawable.<clinit>(InternalR.java:119)
... 15 more
I would appreciate if anyone can suggest anything to fix this.
Not sure you'll find a fix for this: it sounds like the ROM was built without that resource as part of the OS image. They'll probably need a new ROM to get around that.

Categories

Resources