Open ghost opened 8 years ago
I'm still struggling with this and would appreciate your feedback @EddyVerbruggen
By the way I get the same error ("10") using your demo index.html
Ok, so I just removed the plugin (from git) and reinstalled the one on npm... and that one works fine!
Except that it says it's using a depreciated version of the API.
Please can you assist.
Thanks.
The version on git right now was updated to remove the usage of deprecated API versions.
What versions of Android are each device running?
Yes I'm aware that the git version is using the later API, however it gives error 10 on Android 5.0. It works on Android 4.2.2 (the tablet I tested it on) and version 4.4 the other GS4 I test it on.
The plugin on npm (which uses the depreciated API) seems to work on both.
Can you tell me more about your project?
What versions of Cordova/PhoneGap/whatever are you using? How are you building the project? What SHA1 did you use for the dev console set up? How are you calling the plugin? Are you waiting for device ready?
Using Intel XDK, 3357 (latest)
Cordova 5.4.1
Building in the XDK cloud
SHA1 is created using keytool on the APK (as mentioned it's not a SHA1 issue as it works using the depreciated API, also if I do put in the wrong package name or SHA1 I get different error - invalid token or invalid_audience).
I am calling the plugin long after the device is ready as it's being called on a button click. Again this works find using the NPM version - just not the GIT version.
$scope.gLogin = function() {
$ionicLoading.show({templateUrl: "loading.html"});
window.plugins.googleplus.login(
{'scopes':'profile email',
'webApiKey':'xxx.apps.googleusercontent.com',
'return':true
},
function (data) {
manualLoginResponse('google', data);
},
function (error) {
manualLoginFailed('google', error);
}
);
};
(bear in mind it says "webApiKey" because its the NPM version.)
Okay, I think your issue might be that you're building in the cloud. Building in the cloud means your building on a different system than your own so the SHA1 that you created locally is not the same as the one that's being used in the cloud.
My recommendation would be to try building it locally and see what happens.
No I generate the SHA1 after I receive the compiled APK, trust me its not a SHA1 problem.
I've also just tested it now for you by building the project locally in cordova directly... get my SHA1 update credentials on google, same error.
The problem is 100% not to do with the SHA1 or package name. I have confirmed this already by virtue of the fact that is WORKS on my tablet running older version of Android and play services. If the SHA1 or package name were wrong, it would not work on any device.
@sammuggPS have you managed to make any headway on this? Really love the plugin and though I do have it working with the NPM version, I'm obviously not wanting to publish it while it's using a depreciated API.
Thanks.
I'm at a loss. I don't know much about Intel XDK, so I'm not sure if there's anything specific to that that could be causing issues.
Is your Android SDK up to date? Do you have Google Play Services installed?
I think perhaps you're missing the problem here....
Even if I build a project using nothing other than cordova - I get error 10 using the GIT version, works with NPM version.
So it's got nothing to do with Intel XDK.
I'm not missing the problem. I'm just trying to narrow down the cause. My previous questions are very important in trying to figure that out. I'm trying to make sure that you have all the prerequisites as detailed here: https://developers.google.com/identity/sign-in/android/start-integrating
Ok, I'm not sure how else to explain this to you.
To summarise. The problem is not to do with SHA1/google dev console settings and it is not to do with the build environment. It thus appears that somewhere in the code of the later version (GIT) it is doing something that newer versions of Android simply does not like. And the error "DEVELOPER_ERROR" is provided, with no further information as to the cause of said error.
I hope this provides more insight from my side.
You can test this yourself though?
1) Please check that Google Play services is up to date. Just to be sure. Just because the NPM version is working doesn't mean your SDK versions are correct for the latest version of the Sign In platform.
2) Can you provide a logcat output of what's happening leading up to the error code? Preferably scoped to just the application.
I meant device logs. Remember it's running native code, so there are separate logs that don't show up in the Chrome debugger. Here are some steps to get the output:
Here you go...
shell@klte:/ $ logcat | grep 14992
logcat | grep 14992
E/Zygote (14992): MountEmulatedStorage()
E/Zygote (14992): v2
I/libpersona(14992): KNOX_SDCARD checking this for 10359
I/libpersona(14992): KNOX_SDCARD not a persona
I/ActivityManager( 905): Start proc za.co.trainingtime.app for activity za.co.trainingtime.app/.MainActivity: pid=14992 uid=10359 gids={50359, 9997, 3003} abi=armeabi-v7a
I/SELinux (14992): Function: selinux_compare_spd_ram, SPD-policy is existed. and_ver=SEPF_SM-G900F_5.0-1 ver=51
I/SELinux (14992): Function: selinux_compare_spd_ram , priority [1] , priority version is VE=SEPF_SM-G900F_5.0-1_0051
E/SELinux (14992): [DEBUG] get_category: variable seinfo: default sensitivity: NULL, cateogry: NULL
I/art (14992): Late-enabling -Xcheck:jni
D/TimaKeyStoreProvider(14992): TimaSignature is unavailable
D/ActivityThread(14992): Added TimaKeyStore provider
D/ResourcesManager(14992): creating new AssetManager and set to /data/app/za.co.trainingtime.app-1/base.apk
I/FirebaseInitProvider(14992): FirebaseApp initialization unsuccessful
I/WebViewFactory(14992): Loading com.google.android.webview version 50.0.2661.86 (code 266108600)
D/ResourcesManager(14992): creating new AssetManager and set to /data/app/com.google.android.webview-1/base.apk
I/cr_LibraryLoader(14992): Time to load native libraries: 6 ms (timestamps 5344-5350)
I/cr_LibraryLoader(14992): Expected native library version number "50.0.2661.86", actual native library version number "50.0.2661.86"
V/WebViewChromiumFactoryProvider(14992): Binding Chromium to main looper Looper (main, tid 1) {359eb708}
I/cr_LibraryLoader(14992): Expected native library version number "50.0.2661.86", actual native library version number "50.0.2661.86"
I/chromium(14992): [INFO:library_loader_hooks.cc(143)] Chromium logging enabled: level = 0, default verbosity = 0
I/cr_BrowserStartup(14992): Initializing chromium process, singleProcess=true
E/ApkAssets(14992): Error while loading asset assets/natives_blob_64.bin: java.io.FileNotFoundException: assets/natives_blob_64.bin
E/ApkAssets(14992): Error while loading asset assets/snapshot_blob_64.bin: java.io.FileNotFoundException: assets/snapshot_blob_64.bin
I/Adreno-EGL(14992):
Can you do it again without the grep command? Just want to make sure there isn't an error call that's getting filtered out.
The logcat is completely polluted by many apps on the device, it would be next to impossible to siphon out this apps logs if I did that?
I'll try to narrow it down. I'm just looking for anything out of the ordinary, specifically errors or exceptions.
Here you go, it seems it might have something to do with: E/Parcel ( 905): Class not found when unmarshalling: com.google.android.gms.auth.api.signin.internal.SignInConfiguration
E/Parcel ( 905): java.lang.ClassNotFoundException: com.google.android.gms.auth.api.signin.internal.SignInConfiguration
E/Parcel ( 905): at java.lang.Class.classForName(Native Method)
E/Parcel ( 905): at java.lang.Class.forName(Class.java:308)
E/Parcel ( 905): at java.lang.Class.forName(Class.java:272)
E/Parcel ( 905): at android.os.Parcel.readParcelableCreator(Parcel.java:2275)
E/Parcel ( 905): at android.os.Parcel.readParcelable(Parcel.java:2239)
E/Parcel ( 905): at android.os.Parcel.readValue(Parcel.java:2146)
E/Parcel ( 905): at android.os.Parcel.readArrayMapInternal(Parcel.java:2479)
E/Parcel ( 905): at android.os.BaseBundle.unparcel(BaseBundle.java:221)
E/Parcel ( 905): at android.os.BaseBundle.getString(BaseBundle.java:918)
E/Parcel ( 905): at android.content.Intent.getStringExtra(Intent.java:5378)
E/Parcel ( 905): at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1759)
E/Parcel ( 905): at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:1305)
E/Parcel ( 905): at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:4616)
E/Parcel ( 905): at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:4454)
E/Parcel ( 905): at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:142)
E/Parcel ( 905): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3021)
E/Parcel ( 905): at android.os.Binder.execTransact(Binder.java:446)
E/Parcel ( 905): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.auth.api.signin.internal.SignInConfiguration" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
E/Parcel ( 905): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E/Parcel ( 905): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/Parcel ( 905): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
E/Parcel ( 905): ... 17 more
Yeah "Class not found" could definitely be an issue. So for some reason, your phone doesn't have, or isn't getting, the up to date Google APIs, but your tablet is.
The following sequence occurs every time error '10' and the SignInConfiguration exception comes up:
I/GooglePlugin(32377): Building Google options
I/GooglePlugin(32377): Building GoogleApiClient
I/GMPM (32485): App measurement is starting up
I/GooglePlugin(32377): GoogleApiClient built
I/GooglePlugin(32377): Determining command to execute
I/GooglePlugin(32377): Trying to Log in!
I/Timeline(32377): Timeline: Activity_launch_request id:za.co.trainingtime.app time:258885721
E/PersonaManagerService( 905): inState(): stateMachine is null !!
E/GMPM (32485): getGoogleAppId failed with status: 10
E/GMPM (32485): Uploading is not possible. App measurement disabled
E/Parcel ( 905): Class not found when unmarshalling: com.google.android.gms.auth.api.signin.internal.SignInConfiguration
E/Parcel ( 905): java.lang.ClassNotFoundException: com.google.android.gms.auth.api.signin.internal.SignInConfiguration
Quick search of 'getGoogleAppId failed with status: 10' brought me to the following Q/A: http://stackoverflow.com/questions/33531689/error-getgoogleappid-failed-with-status-10-android-kitkat-gcm-and-google-driv
Hope that can help you out! I don't know what other Google things you're using.
Nope, it does not help unfortunately. They're on about the Google credentials, but as I've said numerous times, this works when I use the NPM version with the same method of obtaining credentials and setting in the dev console.
It's got more to do with the fact that the new version on GIT is doing things differently and Android Lollipop doesn't like it.
Since the NPM version seems to work, what would the repercussions be if I just used that? Would my app eventually stop working?
I think I have managed to get it to work now with the GIT version....
However, with the NPM version I was returned values such as givenName and familyName, yet on the GIT version these are not returned... is there a reason for this?
Looking at the GIT java I see you've not put it in there, whereas in the NPM java its there:
GIT: try { Log.i(TAG, "trying to get account information");
result.put("email", acct.getEmail());
//only gets included if requested (See Line 164).
result.put("idToken", acct.getIdToken());
//only gets included if requested (See Line 166).
result.put("serverAuthCode", acct.getServerAuthCode());
result.put("userId", acct.getId());
result.put("displayName", acct.getDisplayName());
result.put("imageUrl", acct.getPhotoUrl());
this.savedCallbackContext.success(result);
}
NPM: try { result.put("email", email); // in case there was no internet connection, this may be null if (user != null) { result.put("userId", user.getId()); result.put("displayName", user.getDisplayName()); result.put("gender", getGender(user.getGender())); if (user.getImage() != null) { result.put("imageUrl", user.getImage().getUrl()); } if (user.getName() != null) { result.put("givenName", user.getName().getGivenName()); result.put("middleName", user.getName().getMiddleName()); result.put("familyName", user.getName().getFamilyName()); if (user.hasAgeRange()) { if (user.getAgeRange().hasMin()) { result.put("ageRangeMin", user.getAgeRange().getMin()); } if (user.getAgeRange().hasMax()) { result.put("ageRangeMax", user.getAgeRange().getMax()); } } if (user.hasBirthday()) { result.put("birthday", user.getBirthday()); } } } resolveToken(email, result); }
Nevermind, I'll just make a $http call to https://www.googleapis.com/oauth2/v3/tokeninfo?id_token= with the token received from the plugin so I can get the user details that way. Thanks.
What did you change to get the Git version to work?
And yes there is an explanation for less info coming back:
When I refactored the plugin, one of my goals was to narrow the scope of its functionality. Part of narrowing that scope meant more clearly defining the purpose of the plugin: to identify and authenticate a user using Google. The default information coming back from the Git version is focused on those aspects: identity from name, email, and picture + authentication through a valid idToken and/or a valid serverAuthCode being returned.
In the README, I stated that any further information, i.e. birthday, age range, etc. is specific to whatever application this is being used in and beyond the scope of this plugin's purposes.. Therefore, the retrieval of any additional information is on the developer (i.e. You) to implement into their application.
It appears you do actually need the json file, because once I added that back, it started to work. shrug.
Understood regarding the removal of familyName etc, I've just made use of separate calls to the Web API using the accessToken in order to get these now.
Thanks for all your assistance with my issue!
Ohhhh that's weird. Where did you add the json file?
In the project root. I originally did not have one because your instructions say you no longer need one for Android. But after adding it and making sure it had the correct details in it, the app magically began working shrug
hi @lemondesigns, can you please inform , how you have resolve this issue, I am not understand , what you mean by saying that you have add the json file in the project root, (which json file) please inform to me in some detail, as I am very new to all this, requested you to please inform?
hurrayyy, I found my mistake that i am doing, I am using different id in config.xml and using different name, when creating configuration file for IOS/Android. it should be same
This official docs are really awesome https://github.com/EddyVerbruggen/cordova-plugin-googleplus
But I am able to do this by using git repo only, when i am using npm module for adding plugin getting deprecated API error.
Thanks a lot anyway, This article also helps me a lot
@rajitgarg2 Thanks for referencing the official docs! We're continually trying to improve them, so let us know if there's any additions we can make.
Hello Please follow the following steps and download the google-service.json and put it in www directory it's working fine for me.
Link for the steps. https://developers.google.com/identity/sign-in/android/start?configured=true
I have tried lot's of option but then success using above steps.
Hi,
I've got this working fine on my Samsung Gallaxy Tab, but using the exact same APK (so same SHA1 key etc) on my Samsung Gallaxy S5 produces an error code "10". Which according to Google's status codes means developer error.
I don't understand what could be causing the problem on the S5 but working on the TAB3.
Please can you perhaps shed some light on this form me?