Android Question B4A 7.8 beta#2 - Firebase Firestore dependencies - Part 3

DonManfred

Expert
Licensed User
Longtime User
After installing Beta #2 i checked again....
I now get firestore partially working. But it ends in a Crash.

Please note that we are using okhtp3 in B4A.
Firestore is referencing a 2.x.x Version of okhttp. Based on @Erel answer in Part 1 of my questions i removed the 3rd party dependency from the firestore.pom file and added a b4a reference to okhttputils2... The compiling process goes on after this.

Logger verbunden mit: 9885e6514556383552
--------- beginning of crash
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
SignedIn: M**** S*****
FirebaseFirestore.setLoggingEnabled(logging)
FirebaseFirestore.getInstance();
after FirebaseFirestore.getInstance();

DocId: ExdxFwZyWM8yXdPpoJit ' GREAT. This is a ref from Firestore

java.lang.RuntimeException: Internal error in Firestore (0.6.6-dev).
at com.google.android.gms.internal.zzeti.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/squareup/okhttp/ConnectionSpec$Builder;
at io.grpc.okhttp.zzp.<clinit>(Unknown Source)
at io.grpc.okhttp.zzp.zztx(Unknown Source)
at io.grpc.okhttp.OkHttpChannelProvider.zztn(Unknown Source)
at io.grpc.zzax.zztm(Unknown Source)
at com.google.android.gms.internal.zzert.<init>(Unknown Source)
at com.google.android.gms.internal.zzelq.zza(Unknown Source)
at com.google.android.gms.internal.zzels.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at com.google.android.gms.internal.zzetf$zza.run(Unknown Source)
at java.lang.Thread.run(Thread.java:762)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.squareup.okhttp.ConnectionSpec$Builder" on path: DexPathList[[zip file "/data/app/b4a.example.firestore-1/base.apk"],nativeLibraryDirectories=[/data/app/b4a.example.firestore-1/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

I guess that in V3 of okhttp they removed some parts which was available in 2.x.x and this causes the crash
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Based on @Erel answer in Part 1 of my questions i removed the 3rd party dependency from the firestore.pom file
This is no longer needed. B4A will ignore missing external dependencies.

Firestore is referencing a 2.x.x Version of okhttp
Are you sure? It is a bit strange. This means that you will not be able to use it together with OkHttp / OkHttpUtils2.

Download OkHttp v2 and add it with #AdditionalJar (instead of OkHttpUtils2).
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
This means that you will not be able to use it together with OkHttp / OkHttpUtils2.
Right. I removed okhttp, added a reference to the v2 and tried again. It works now.

But, as you said, using okhttputils together does not work as of now.

Ok, now i´m facing other problems but i´m pretty sure it is a error in the wrapper :D
 
Upvote 0

Grant Fullen

Member
Licensed User
That's what's up! Just so you know I'd be fine with paid only instead of donation. That's going to be a very fine and useful library if done correctly.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
It is a bit strange
Yes, but this way i got a Valid Firestore instance (with beta#2 so i think you added the missing field to the CreateResource. Thank you for this :))
It is now working. I can get an instance, get a Collection, get all Documents inside the Collection... I can order them, but limiting the results is not working as yet.
Or other... I can get the limit working. OR the order. But not both at the same time.

But it is working and i did some progress. Stay tuned ;-)
 
Upvote 0
Top