PokeGOAPI-Java icon indicating copy to clipboard operation
PokeGOAPI-Java copied to clipboard

Error when using GoogleAutoCredentialProvider

Open meher19 opened this issue 10 years ago • 43 comments

When i instanciate GoogleAutoCredentialProvider, i have this exception : java.lang.NoClassDefFoundError: Failed resolution of: Lsvarzee/gps/gpsoauth/Gpsoauth;

I tested this with an oldest jar of the api, it's working, so there is an issue in the latest version of the api.

This is my code :

OkHttpClient httpClient = new OkHttpClient();
        GoogleAutoCredentialProvider provider = new GoogleAutoCredentialProvider(httpClient, username, password);
        PokemonGo go = new PokemonGo(provider, httpClient);

meher19 avatar Aug 14 '16 09:08 meher19

Add compile 'svarzee.gps:gpsoauth:0.3' to gradle.build under dependencies

AbandonedCart avatar Aug 14 '16 09:08 AbandonedCart

This resolved the Lsvarzee error, but the auth still not working, when i debug my app a problem occurs in the class Gpsoauth.java in this line : return httpClient.newCall(request).execute(); When i reach this line there is no triggered exception, but there is no response from the call, the debugger still blocked in this line.

meher19 avatar Aug 14 '16 10:08 meher19

There was only a slight chance importing that dependency would override the one from the library. You'd have to build the library to resolve the issue of that didn't work.

AbandonedCart avatar Aug 14 '16 10:08 AbandonedCart

i checked this when debugging my app, it's using the Gpsoauth class from the imported dependency, i checked too if this class exists in the api but nothing.

meher19 avatar Aug 14 '16 11:08 meher19

Could you resolve your problem?

FabianTerhorst avatar Aug 15 '16 18:08 FabianTerhorst

Close this for now looks unrelated to this library.

FabianTerhorst avatar Aug 15 '16 19:08 FabianTerhorst

No, i not resolved my problem

meher19 avatar Aug 17 '16 09:08 meher19

We need an updated jcenter dependencie to better debug this.

FabianTerhorst avatar Aug 17 '16 11:08 FabianTerhorst

httpClient.newCall(request).execute(); is most likely being implemented incorrectly. See https://github.com/Grover-c13/PokeGOAPI-Java#usage-example-mostly-how-to-login- and https://github.com/Grover-c13/PokeGOAPI-Java/tree/Development/sample/src/main/java/com/pokegoapi/examples

AbandonedCart avatar Aug 17 '16 11:08 AbandonedCart

@LoungeKatt The example is showing the usage of GoogleUserCredentialProvider, but in my case i try to use the GoogleAutoCredentialProvider which is different, this auth mode worked in previous versions of the API but now i think there is a regression in the last version. The line httpClient.newCall(request).execute(); is in the class Gpsoauth.java from the API source code, by debugging this class i noticed that's the problem occurs in this call.

meher19 avatar Aug 17 '16 11:08 meher19

The reason only one example is shown is that each credential provider is designed to follow the same structure. The issue is that you appear to be attempting to recreate the inner functionality locally.

AbandonedCart avatar Aug 17 '16 12:08 AbandonedCart

No i'm just trying to use the credentials provider as shown in the example, look at my first post it's contains my source code.

meher19 avatar Aug 17 '16 12:08 meher19

Then there should be no issue with Gpsoauth, since that is an external dependency handled by the API library. You should verify you are using the library-all file that includes the dependencies.

Perhaps it would be best to wait for the bintray build of the library to update, since the problem appears to be specific to your build of the library.

AbandonedCart avatar Aug 17 '16 12:08 AbandonedCart

now i'm using the PokeGOAPI-library-0.4.0.jar that's i builded from a clean clone of the API source code, this jar does not contains svarzee.gps dependency required by the the API, resulting of the error i described in a earlier post. In the previous versions of the API the dependecy was included, i can't understand why the developors removed it in the last version. So i added the depenency in my project to resolve the problem, but i can't figure out why it's still not working like it was when the dependecy was included in the API, this is the question..

meher19 avatar Aug 17 '16 13:08 meher19

You want PokeGOAPI-library-all-0.4.0.jar. This is the exact name of the file. The developers did not remove the dependency, you are using the wrong file.

https://github.com/Grover-c13/PokeGOAPI-Java/blob/Development/library/build.gradle#L94

AbandonedCart avatar Aug 17 '16 13:08 AbandonedCart

ok this resolved my problem, now i still getting 0 results from the getCatchablePokemon method, look at https://github.com/Grover-c13/PokeGOAPI-Java/issues/513 issue

meher19 avatar Aug 18 '16 10:08 meher19

Update : i tried also with a new Ptc account, and i added DeviceInfo a SensorInfo data to PokemonGo object but it still returning 0 results.

meher19 avatar Aug 18 '16 11:08 meher19

you know what sensorinfo needs for the values?

FabianTerhorst avatar Aug 18 '16 11:08 FabianTerhorst

sensorInfo.setAccelNormalizedZ(0); It needs more values ?

meher19 avatar Aug 18 '16 11:08 meher19

We don´t know what to set for the other values.

FabianTerhorst avatar Aug 18 '16 11:08 FabianTerhorst