Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

App Crash #118

Open
zigzag-way opened this issue Sep 17, 2015 · 37 comments
Open

App Crash #118

zigzag-way opened this issue Sep 17, 2015 · 37 comments

Comments

@zigzag-way
Copy link

Since I integrated this plugin I began recieving lots of crashes like this one:

Fatal Exception: java.lang.RuntimeException
Unable to resume activity {mobi.appcoins/mobi.appcoins.AppCoins}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=0, data=null} to activity {mobi.appcoins/mobi.appcoins.AppCoins}: java.lang.NullPointerException
 raw
android.app.ActivityThread.performResumeActivity (ActivityThread.java:2458)
android.app.ActivityThread.handleResumeActivity (ActivityThread.java:2486)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2000)
android.app.ActivityThread.access$600 (ActivityThread.java:128)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1161)
android.os.Looper.loop (Looper.java:137)
android.app.ActivityThread.main (ActivityThread.java:4517)
java.lang.reflect.Method.invokeNative (Method.java)
dalvik.system.NativeStart.main (NativeStart.java)
@EddyVerbruggen
Copy link
Owner

That's not a really useful stacktrace unfortunately. Can you share a stripped down version of your app (or a new cordova cli one) which reproduces this problem so I can take a look?

@zigzag-way
Copy link
Author

http://crashes.to/s/8cc21611288 - here are all the details from CrashLytics

@zigzag-way
Copy link
Author

I can not reproduce it, but see in production on a certain amount of users thx to CrashLytics

@zigzag-way
Copy link
Author

Any ideas? At this moment this plugins is the most crashable part of my app... May be I`m using it wrong?

@zigzag-way
Copy link
Author

More and more crashes - http://crashes.to/s/8cc21611288

EddyVerbruggen added a commit that referenced this issue Oct 14, 2015
@EddyVerbruggen
Copy link
Owner

Thanks for those Crashlytics details, really helpful!

Can you try a new version from master to see if this fixes the issues?

@zigzag-way
Copy link
Author

Yes, I will integrate it on the next version within next 2-3 hours

@zigzag-way
Copy link
Author

Ok. No lets check for the next few days to see the stats

@zigzag-way
Copy link
Author

As I can see - you`ve fixed it!
But ))) It seems we got a new issue
http://crashes.to/s/0b6b00f47c8

@zigzag-way
Copy link
Author

Eddy? Did you check the last\new issue (http://crashes.to/s/0b6b00f47c8)?

@zigzag-way
Copy link
Author

More crashes in the new app: http://crashes.to/s/16da04e3dae and http://crashes.to/s/d2d8cad7e4a

@zigzag-way
Copy link
Author

shinyMetilda pushed a commit to shinyMetilda/cordova-plugin-googleplus that referenced this issue Mar 22, 2016
@zigzag-way
Copy link
Author

http://crashes.to/s/51c3798b11b - I thought this one should leave in the last update ((( but it`s still there

@sammugg
Copy link

sammugg commented Apr 4, 2016

@zigzag-way,

Have you installed the app from GitHub or from the npm registry? If you installed from npm, please try out the latest code from GitHub! The usage has changed a bit, but I hope it clears up the issue you've been having.

@zigzag-way
Copy link
Author

Yes. I did. From git.

@sammugg
Copy link

sammugg commented Apr 4, 2016

@zigzag-way,

Can you get some more info by USB debugging the app on a device? I'm want to be sure that your options are making it into GooglePlus.java.

Side note, if the issue is what I think it is, @pranay-mathur is running into the same problem you are. He started issue thread #199.

If it's the same issue, let's move this conversation over to that thread.

@zigzag-way
Copy link
Author

Can you get some more info by USB debugging the app on a device? - no, i cant because i dont face this issue. but my users do.

I use this options to initialize:

                        $window.plugins.googleplus.trySilentLogin(
                            { offline: 'true', webApiKey: WEB_API_KEY },
                            function (user) {
                                console.info('Silent Login: ' + JSON.stringify(user));
                                serverAuth(user);
                            },
                            function (msg) {
                                $ionicLoading.hide();
                                console.error('Silent Login error: ' + msg);
                            }
                        );

@sammugg
Copy link

sammugg commented Apr 4, 2016

@zigzag-way,

First, webApiKey is no longer a valid option. It has been replaced with webClientId. I merged a significant PR the other day that updated the Android side to use Google Sign-In and refactored plugin usage. The current documentation is up to date with those changes.

Second, after looking at my code and your crashlytics page again, I noticed that Line 235 in the latest code is part of a Javadoc comment (I've been at work all day, so I didn't get a chance to check that until now). So, that error, to the best of my knowledge, has two possible causes:

  1. The user has not updated the application, but it's still polling the same analytics system, so the same error shows up.
  2. You're not actually running the latest version of the plugin.

In order for us to be sure that the second case is not the problem, could you please reinstall the plugin using the second (GitHub URL) method found in the README?

@zigzag-way
Copy link
Author

You're not actually running the latest version of the plugin. - How can I check that I`m running the latest version?

@zigzag-way
Copy link
Author

  1. Its definetely not the reason because I track the version and know in which version the issue happened.

@sammugg
Copy link

sammugg commented Apr 5, 2016

Version: Go into the plugin directory and open plugin.xml.
The version that gets pulled from npm (plugin add cordova-plugin-googleplus) is 4.0.8. The version that gets pulled from github (plugin add https://github.com/EddyVerbruggen/cordova-plugin-googleplus) is 4.0.9.

If you are running 4.0.8, I recommend that you update to 4.0.9. The usage is different, and the information you get back is purely directed at authentication and identity.

@zigzag-way
Copy link
Author

Thx, its 4.0.8 now. I`ll update it soon.

@zigzag-way
Copy link
Author

Hm... I`ve update the plugin from git:
Now plugin.xml shows 4.0.9
But package.json show 4.0.8
Which one is correct?

@zigzag-way
Copy link
Author

After the update the new issue came out:
http://crashes.to/s/5c55ff7bb1d

@sammugg
Copy link

sammugg commented Apr 7, 2016

@zigzag-way,

Package.json/Plugin.xml version: That was my bad. I forgot to update the version in package.json when I updated plugin.xml. I just pushed that today (but it's not something that would break anything; just an inconsistency; whoops).

Hmmmm so that crash is at line 275 of GooglePlus.java, which is part of the following if statement:

274: if (mGoogleApiClient == null) {
275:     savedCallbackContext.error("GoogleApiClient was never initialized");
276:     return;
277: }

This tells me two things: The GoogleApiClient was null, but then never got built (which shouldn't happen....), and that an error callback was not provided and/or saved.

Did you ever try removing your android platform entirely then readding it? If not, could you give that a go?

If that doesn't work, can you double check that you're passing in an error callback function?

Those are the only things I can think of right now....

P.S. I know removing the platform seems weird, but other people have done that and on reinstalling things were fixed. Technology's weird, right?

@zigzag-way
Copy link
Author

Btw, I just tried to add it to another Cordova project that is build through Eclipse and it failed.
Description Resource Path Location Type
Auth cannot be resolved GooglePlus.java /src/nl/xservices/plugins line 181 Java Problem
Description Resource Path Location Type
The import com.google.android.gms.auth.api cannot be resolved GooglePlus.java /src/nl/xservices/plugins line 6 Java Problem

All imports
Description Resource Path Location Type
The import com.google.android.gms.auth.api cannot be resolved GooglePlus.java /AppCoins/src/nl/xservices/plugins line 6 Java Problem
failed.

Whats wrong? Before that I successfuly used previous version of the plugin

@sammugg
Copy link

sammugg commented Apr 11, 2016

Hmmm that error means the Auth api is not getting brought into the project at compile.

cordova build android should bring in the Auth api materials from the android sdk on its own. Make sure there aren't any build settings that you're missing.

@zigzag-way
Copy link
Author

http://crashes.to/s/19494d28a81

What am I doing wrong? Why do I get this kind of issues?

@zigzag-way
Copy link
Author

And here is another issue: http://crashes.to/s/4cf818b5a9a

@zigzag-way
Copy link
Author

zigzag-way commented Apr 22, 2016

I`m using the plugin this way:

        window.plugins.googleplus.trySilentLogin(
            {}, //just client usage
            function (obj) {
                console.info('Silent Login: ' + JSON.stringify(obj));
            },
            function (msg) {
                console.error('error: ' + msg);
                window.plugins.googleplus.login(
                    {},
                    function (obj) {
                        console.info('Login: ' + JSON.stringify(obj));
                    },
                    function (msg) {
                        gaPlugin.trackEvent(null, null, "login", "g+ login error", "", 0);
                    }
                );
            }
        );

@sammugg
Copy link

sammugg commented Apr 22, 2016

Are you passing anything in to login when you call it? You should pass in the same variables to make sure the api client is being built as expected.

@zigzag-way
Copy link
Author

zigzag-way commented Apr 22, 2016

Sorry, dont understand what you mean.
Btw, it`s only some % of users facing this issue.

@sammugg
Copy link

sammugg commented Apr 22, 2016

Oh sorry I didn't see googleplus.login in nested in the code snippet you posted.

My recommendation is that you use login and trySilentLogin separately.

i.e., on app start up, call trySilentLogin and handle the result of that. Then provide a button of some sort for the user to click when they are ready to log in to the application.

(I'm glad to hear it's only some % of users. That means that it could be an issue with their version of Android or Google Play services. I don't know much more than that.)

@zigzag-way
Copy link
Author

One more error:
http://crashes.to/s/d6ab4561a41

May be this will help you to find the issue.

@zigzag-way
Copy link
Author

May be this happens if there is no gpservices on the device?

@zigzag-way
Copy link
Author

No more ideas? http://crashes.to/s/19494d28a81 - this is still my most frequent bug mostly affected by Android 4.X

@sammugg
Copy link

sammugg commented Aug 21, 2016

No other users of this plugin have reported this particular exception. My only suggestion is that you make sure all of your build tools and other SDK items are up to date. This plugin, and the Google sources it uses, are supposed to be compatible back to Android 2.3.

From the Android documentation:

Google Sign-In for Android has the following requirements:

  • A compatible Android device that runs Android 2.3 or newer and includes the Google Play Store or an emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or newer and has Google Play Services version 9.2.1 or newer.
  • The latest version of the Android SDK, including the SDK Tools component. The SDK is available from the Android SDK Manager in Android Studio.
  • A project configured to compile against Android 2.3 (Gingerbread) or newer.
  • The Google Play Services SDK:
    1. In Android Studio, select Tools > Android > SDK Manager.
    2. Scroll to the bottom of the package list and select Extras > Google Play services. The package is downloaded to your computer and installed in your SDK environment at android-sdk-folder/extras/google/google_play_services.

pwbs pushed a commit to pwbs/cordova-plugin-googleplus that referenced this issue Jun 27, 2017
# This is the 1st commit message:
# This is a combination of 3 commits.
# This is the 1st commit message:
# This is a combination of 2 commits.
# This is the 1st commit message:

# This is a combination of 2 commits.
# This is the 1st commit message:

# This is a combination of 2 commits.
# This is the 1st commit message:

# This is a combination of 2 commits.
# This is the 1st commit message:

# This is a combination of 7 commits.
# This is the 1st commit message:
# This is a combination of 3 commits.
# This is the 1st commit message:
# This is a combination of 3 commits.
# This is the 1st commit message:
# This is a combination of 2 commits.
# This is the 1st commit message:

# This is a combination of 6 commits.
# This is the 1st commit message:
# This is a combination of 10 commits.
# This is the 1st commit message:
Finished implementation

# The commit message EddyVerbruggen#2 will be skipped:

#	Attempt at some decent documentation

# The commit message EddyVerbruggen#3 will be skipped:

#	Attempt at some decent documentation

# The commit message EddyVerbruggen#4 will be skipped:

#	Added iOS screenshots

# The commit message EddyVerbruggen#5 will be skipped:

#	cleanup

# The commit message EddyVerbruggen#6 will be skipped:

#	Added a permission for Android preventing a crash on some devices

# The commit message EddyVerbruggen#7 will be skipped:

#	Cleanup

# The commit message EddyVerbruggen#8 will be skipped:

#	iOSApiKey is for iOS, not for Android :)

# The commit message EddyVerbruggen#9 will be skipped:

#	EddyVerbruggen#3 redirect url not handled when redirected from Google+ app on iOS

# The commit message EddyVerbruggen#10 will be skipped:

#	EddyVerbruggen#6 ADD Birthday and AgeRange

# The commit message EddyVerbruggen#1 will be skipped:

#	EddyVerbruggen#6 ADD Birthday and AgeRange (wasn't really happy with the PR, so I changed it a bit and added iOS support). Thanks for the help!

# The commit message EddyVerbruggen#2 will be skipped:

#	EddyVerbruggen#6 addtional checks on Android

# The commit message EddyVerbruggen#3 will be skipped:

#	Add userId property to let developer to get Google user ID for business logic.

# The commit message EddyVerbruggen#4 will be skipped:

#	EddyVerbruggen#7, needed to manually merge

# The commit message EddyVerbruggen#5 will be skipped:

#	EddyVerbruggen#7, needed additional flag

# The commit message EddyVerbruggen#6 will be skipped:

#	Missing dependency for iOS 8 SDK

# The commit message EddyVerbruggen#7 will be skipped:

#	Android - play services jar fixed version

# The commit message EddyVerbruggen#8 will be skipped:

#	Android playservices updated to 21

# The commit message EddyVerbruggen#9 will be skipped:

#	Update README.md
#
#	Fix typo. I believe this is for iOS only right now and not Android yet if I'm not mistaken.

# The commit message EddyVerbruggen#10 will be skipped:

#	A note about Android config

# The commit message EddyVerbruggen#1 will be skipped:

#	EddyVerbruggen#15 added troubleshooting section

# The commit message EddyVerbruggen#2 will be skipped:

#	Adding idToken to Android
#
#	Based on this gist [1] I'm adding support for getting the auth oauth2 token
#	that Google generates after the user accepts the login.
#
#	[1] https://gist.github.com/ianbarber/5170508

# The commit message EddyVerbruggen#3 will be skipped:

#	Introducing idToken and oauthToken
#
#	Allow the user to configure the service so any of the 3 possibles can be reached
#	when the user passes webApiKey in the credentials dictionary will get a JWT token
#	id, if androidApiKey is set in the credentials then an off-line capable oauth2
#	token bearer will be generated in the oauthToken value, while if no argument is
#	set a simple oauth2 token will get generated.

# The commit message EddyVerbruggen#4 will be skipped:

#	Adding extra necessary permissions

# The commit message EddyVerbruggen#5 will be skipped:

#	EddyVerbruggen#12 oauthToken for iOS

# The commit message EddyVerbruggen#6 will be skipped:

#	EddyVerbruggen#22 User-cancelled login on iOS - Neither the success nor error callbacks are called

# The commit message EddyVerbruggen#7 will be skipped:

#	EddyVerbruggen#26 Preparing submission to plugins.cordova.io

# The commit message EddyVerbruggen#8 will be skipped:

#	Prep plugin registry release (as tarball, to circumvent an npm symlink issue)

# The commit message EddyVerbruggen#9 will be skipped:

#	Added a warning about the current state of the plugman publish command

# The commit message EddyVerbruggen#10 will be skipped:

#	Removing the symlinks from iOS libs to be plugman (npm) publish compliant

# The commit message EddyVerbruggen#1 will be skipped:

#	Removing the symlinks from iOS libs to be plugman (npm) publish compliant

# The commit message EddyVerbruggen#2 will be skipped:

#	Removing the symlinks from iOS libs to be plugman (npm) publish compliant

# The commit message EddyVerbruggen#3 will be skipped:

#	Removing the symlinks from iOS libs to be plugman (npm) publish compliant

# The commit message EddyVerbruggen#4 will be skipped:

#	Removing the symlinks from iOS libs to be plugman (npm) publish compliant

# The commit message EddyVerbruggen#5 will be skipped:

#	Removing the symlinks from iOS libs to be plugman (npm) publish compliant

# The commit message EddyVerbruggen#6 will be skipped:

#	Removing the symlinks from iOS libs to be plugman (npm) publish compliant

# The commit message EddyVerbruggen#7 will be skipped:

#	Removing the symlinks from iOS libs to be plugman (npm) publish compliant

# The commit message EddyVerbruggen#8 will be skipped:

#	EddyVerbruggen#37 Google+ login using web browser is rejected on the App Store.

# The commit message EddyVerbruggen#9 will be skipped:

#	From Cordova 4 setActivityResultCallback is on CordovaInterfaceImpl

# The commit message EddyVerbruggen#10 will be skipped:

#	Not importing android-support-v4

# The commit message EddyVerbruggen#1 will be skipped:

#	EddyVerbruggen#45 login and trySilendLogin now return userdata on Android

# The commit message EddyVerbruggen#2 will be skipped:

#	Update plugin.xml

# The commit message EddyVerbruggen#3 will be skipped:

#	Update plugin.xml

# The commit message EddyVerbruggen#4 will be skipped:

#	EddyVerbruggen#56 new playservices version

# The commit message EddyVerbruggen#5 will be skipped:

#	npm

# The commit message EddyVerbruggen#6 will be skipped:

#	or not to npm..

# The commit message EddyVerbruggen#7 will be skipped:

#	replace deprecated dependency plugin

# The commit message EddyVerbruggen#8 will be skipped:

#	New ID, published to npm

# The commit message EddyVerbruggen#9 will be skipped:

#	New ID, published to npm

# The commit message EddyVerbruggen#10 will be skipped:

#	PGB note

# The commit message EddyVerbruggen#1 will be skipped:

#	Update dependencies to gradle format to fix EddyVerbruggen#64

# The commit message EddyVerbruggen#2 will be skipped:

#	bump

# The commit message EddyVerbruggen#3 will be skipped:

#	Switch to Google Sign-In SDK for iOS
#
#	This should fix Apple rejection from popping up Safari.
#	Will update README soon.
#	Update version to 3.0.0.

# The commit message EddyVerbruggen#4 will be skipped:

#	Allowed scope to be passed into signin

# The commit message EddyVerbruggen#5 will be skipped:

#	Attempt to fix offline screen

# The commit message EddyVerbruggen#6 will be skipped:

#	Cleanup for google plus connection with scopes and offline access

# The commit message EddyVerbruggen#7 will be skipped:

#	Fixed REVERSED_CLIENT_ID variable

# The commit message EddyVerbruggen#8 will be skipped:

#	Invalid quotes (according to my IDE)

# The commit message EddyVerbruggen#9 will be skipped:

#	Made ios use scopes

# The commit message EddyVerbruggen#10 will be skipped:

#	Added server auth code logic for ios

# The commit message EddyVerbruggen#1 will be skipped:

#	Made server auth code not throw a null reference

# The commit message EddyVerbruggen#2 will be skipped:

#	Plugin update to 4.0.0:
#	- Changed the ID to cordova-plugin-googleplus (again)
#	- Wider Android dependent fwk compatibility
#	- Documented scopes feature
#	- Removed the need for the iosApiKey

# The commit message EddyVerbruggen#3 will be skipped:

#	Fixed npm reference in doc

# The commit message EddyVerbruggen#4 will be skipped:

#	EddyVerbruggen#95 Crash when using isAvailable method before login

# The commit message EddyVerbruggen#5 will be skipped:

#	access_token fix for iOS
#
#	The access_token will now be returned as: accessToken

# The commit message EddyVerbruggen#6 will be skipped:

#	* generate both oauthToken and idToken

# The commit message EddyVerbruggen#7 will be skipped:

#	Added an "offline" parameter to enable getting a server auth token even without androidApiKey.

# The commit message EddyVerbruggen#8 will be skipped:

#	Added info to README about the API key for serverClientId.

# The commit message EddyVerbruggen#9 will be skipped:

#	Google decided to change a link without adding a nice redirect

# The commit message EddyVerbruggen#10 will be skipped:

#	Enabled getting serverAuthCode when the webApiKey param is set.

# The commit message EddyVerbruggen#2 will be skipped:

#	EddyVerbruggen#108 Added an option to generate access token for offline access on Android

# The commit message EddyVerbruggen#3 will be skipped:

#	EddyVerbruggen#82 Google Plus window not loading!
#	EddyVerbruggen#113 Not getting user extras (e.g. imageUrl) in callback object. Re-added imageUrl for iOS

# The commit message EddyVerbruggen#4 will be skipped:

#	Android: Ensure a new one time token on each login
#
#	When using the androidApiKey parameter a short-lived one time token
#	is generated, which can then be passed to the server where it can be
#	exchanged for a proper access and refresh token. Since all tokens get
#	cached by GoogleAuthUtil logging in a second time will cause the token
#	to be invalid if it was used before or some time has passed.

# The commit message EddyVerbruggen#5 will be skipped:

#	EddyVerbruggen#118 App Crash

# The commit message EddyVerbruggen#6 will be skipped:

#	EddyVerbruggen#147 Android fwk tags

# The commit message EddyVerbruggen#7 will be skipped:

#	Android 6.0
#
#	Added call to request permission

# The commit message EddyVerbruggen#8 will be skipped:

#	EddyVerbruggen#149 Android 6.0

# The commit message EddyVerbruggen#9 will be skipped:

#	IOS Build fails with compilation errors EddyVerbruggen#150

# The commit message EddyVerbruggen#10 will be skipped:

#	IOS Build fails with compilation errors EddyVerbruggen#150

# The commit message EddyVerbruggen#1 will be skipped:

#	Android: Gets a new offline token on each login
#
#	Based on EddyVerbruggen#119
#	I tested this on an app I'm working where every authentication attempt returned the same invalid token. After applying this change, the authentication works fine each time.

# The commit message EddyVerbruggen#2 will be skipped:

#	Get refreshToken on iOS sign in
#
#	The refresh token is a useful token for third party apps, to refresh the access token and keep users logged in.

# The commit message EddyVerbruggen#3 will be skipped:

#	Update README.md

# The commit message EddyVerbruggen#4 will be skipped:

#	Updated Google Sign-In iOS SDK to 2.4.0

# The commit message EddyVerbruggen#5 will be skipped:

#	Enabled GoogleOpenSource.framework explicitely

# The commit message EddyVerbruggen#6 will be skipped:

#	EddyVerbruggen#153 Ios updated google framework

# The commit message EddyVerbruggen#2 will be skipped:

#	EddyVerbruggen#168 IOS Build failure with this plugin

# The commit message EddyVerbruggen#2 will be skipped:

#	Added a few npm keywords

# The commit message EddyVerbruggen#3 will be skipped:

#	Update GooglePlus.java
#
#	Fix for app crash on android 6

# The commit message EddyVerbruggen#2 will be skipped:

#	A note about failing Android builds

# The commit message EddyVerbruggen#3 will be skipped:

#	Adding a link to how to use keytool

# The commit message EddyVerbruggen#2 will be skipped:

#	Update README.md

# The commit message EddyVerbruggen#3 will be skipped:

#	Update README.md

# The commit message EddyVerbruggen#4 will be skipped:

#	Google success login redirects to google.com issue fixed

# The commit message EddyVerbruggen#5 will be skipped:

#	iOS readme updated to include latest Google SDK changes

# The commit message EddyVerbruggen#6 will be skipped:

#	Update README.md

# The commit message EddyVerbruggen#7 will be skipped:

#	Update README.md

# The commit message EddyVerbruggen#2 will be skipped:

#	Remove OpenSource and Plus libraries.

# The commit message EddyVerbruggen#2 will be skipped:

#	ignoring some more files

# The commit message EddyVerbruggen#2 will be skipped:

#	Google SignIn framework bump

# The commit message EddyVerbruggen#2 will be skipped:

#	ignore

# The commit message EddyVerbruggen#2 will be skipped:

#	testing sth

# The commit message EddyVerbruggen#3 will be skipped:

#	testing sth

# The commit message EddyVerbruggen#2 will be skipped:

#	new demos for firebase and ionic2+firebase

# The commit message EddyVerbruggen#3 will be skipped:

#	typo fix
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants