Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error NoClassDefFound on Android #50

Closed
pompobit opened this issue Jul 19, 2016 · 6 comments
Closed

Error NoClassDefFound on Android #50

pompobit opened this issue Jul 19, 2016 · 6 comments

Comments

@pompobit
Copy link

I'm trying to use these API on Android, I built the bundle, imported in the project and added compile files('libs/PokeGOAPI-Java_bundle-0.0.1-SNAPSHOT.jar') on gradle.build (I'm on Android studio).
I can correctly build my project and run it, but at runtime when I try to log in (both with PTC and Google) the app crashes.
Here's the log:

java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:309) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) at java.util.concurrent.FutureTask.setException(FutureTask.java:223) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: java.lang.NoClassDefFoundError: Failed resolution of: LPOGOProtos/Networking/EnvelopesOuterClass$Envelopes$RequestEnvelope$AuthInfo; at com.pokegoapi.auth.GoogleLogin.login(GoogleLogin.java:78) at com.acatch.pompomon.pokemon.MainActivity$Login.doInBackground(MainActivity.java:98) at com.acatch.pompomon.pokemon.MainActivity$Login.doInBackground(MainActivity.java:56) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)  at java.lang.Thread.run(Thread.java:818)  Caused by: java.lang.ClassNotFoundException: Didn't find class "POGOProtos.Networking.EnvelopesOuterClass$Envelopes$RequestEnvelope$AuthInfo" on path: DexPathList[[zip file "/data/app/com.acatch.pompomon.pokemon-2/base.apk"],nativeLibraryDirectories=[/data/app/com.acatch.pompomon.pokemon-2/lib/arm, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) at com.pokegoapi.auth.GoogleLogin.login(GoogleLogin.java:78)  at com.acatch.pompomon.pokemon.MainActivity$Login.doInBackground(MainActivity.java:98)  at com.acatch.pompomon.pokemon.MainActivity$Login.doInBackground(MainActivity.java:56)  at android.os.AsyncTask$2.call(AsyncTask.java:295)  at java.util.concurrent.FutureTask.run(FutureTask.java:237)  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)  at java.lang.Thread.run(Thread.java:818)  Suppressed: java.lang.NoClassDefFoundError: POGOProtos.Networking.EnvelopesOuterClass$Envelopes$RequestEnvelope$AuthInfo at dalvik.system.DexFile.defineClassNative(Native Method) at dalvik.system.DexFile.defineClass(DexFile.java:226) at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219) at dalvik.system.DexPathList.findClass(DexPathList.java:338) at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54) ... 11 more Suppressed: java.lang.ClassNotFoundException: POGOProtos.Networking.EnvelopesOuterClass$Envelopes$RequestEnvelope$AuthInfo at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 10 more Caused by: java.lang.NoClassDefFoundError: > > Class not found using the boot class loader; no stack trace available

So it seems it cannot find anything of POGO library (at runtime, at build time everything is fine).
I'm not sure but searching around seems like it could something related to DeX: http://stackoverflow.com/questions/28283688/noclassdeffounderror-for-jar-library-at-runtime-in-android-studio but I don't know which modules are defined as Application (I guess there aren't).

So, any idea?
And keep up the good work, if I'll find some time I'll contribute too

@vmarchaud
Copy link
Contributor

Should be fixed in #46 when the server will be stable for testing and merging.

Or you could just build the lib yourself by replacing compileOnly to compile in the gradle build file for the protobuf dependency.

@pompobit
Copy link
Author

I'm looking into #46 but I don't understand, in what way is related to my issue?

@pompobit pompobit reopened this Jul 20, 2016
@vmarchaud
Copy link
Contributor

Check that line of the commit.

@Grover-c13
Copy link
Owner

Is this issue still occurring on latest commit @pompobit

@pompobit
Copy link
Author

@Grover-c13 I can't check now, I will be able to do it in a few hours

@pompobit
Copy link
Author

@Grover-c13 I can confirm that the issue is gone, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants