Android Question FireStore

DonManfred

Expert
Licensed User
Longtime User
Note that the code in this case requires a specific Content (and Structure) in the DB.

B4X:
    fs.Initialize("Firestore",True)
    Dim driver As CollectionReference = fs.collection("Drivers","DriverCollection")
    If driver <> Null Then
        Log("Setting query to get driver")
        'driver.whereEqualTo("id","DonManfred").limit(1).fetch("DriverFetch")
        driver.setEventname("DriverWatch","Driverliste")
        driver.addSnapshotListener
        driver.orderBy("userName").limit(25).fetch("DriverFetch")
        wait for DriverFetch_Snapshot(success As Boolean, snap As QuerySnapshot, info As String)
        Log($"Driver_Snapshot(${snap.Size},${snap})"$)
        Dim meta As SnapshotMetadata = snap.Metadata
        Dim documents As List = snap.Documents
        If documents.IsInitialized Then
            If documents.Size > 0 Then
                For i = 0 To documents.Size-1
                    Dim docsnap As DocumentSnapshot = documents.Get(i)
                    Log("Query DocumentNo: #"&i&": "&docsnap.Id)
                    Dim data As Map = docsnap.Data
                    Log(data)
                Next
            End If
        End If
    Else
        Log("Snapshot does not contain a list of Documents...")
    End If
 
Upvote 0

gregorio_adrian_gimenez

Active Member
Licensed User
Longtime User
Hi,

generates this error Organizing libraries. Error Maven artifact not found: com.google.firebase / firebase-database-collection

I can not compile the code, I think it is because it is not where to paste the Addlib files that download from dropbox. Where should you go specifically? Could you send me a folder route?
 
Last edited:
Upvote 0

gregorio_adrian_gimenez

Active Member
Licensed User
Longtime User
sorry.

Download the files contained in the addlib folder to C: \ Program Files \ Anywhere Software \ Basic4android \ Libraries

then


when I compile the code it generates the following error:
Organizing libraries. Error Maven artifact not found: com.google.protobuf/protobuf-lite


check in sdkmanager and there is nothing to update


this is my code

B4X:
#Region  Project Attributes
    #ApplicationLabel: ITSS Aeropuerto
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
   
    #MultiDex: true


#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
    #BridgeLogger:true

#AdditionalJar: com.google.android.gms:play-services-auth
#AdditionalJar: com.google.android.gms:play-services-base
#AdditionalJar: com.google.firebase:firebase-common
#AdditionalJar: com.google.firebase:firebase-auth
#AdditionalJar: com.google.firebase:firebase-database
#AdditionalJar: com.google.firebase:firebase-core
#AdditionalJar: com.google.firebase:firebase-common
#AdditionalJar: com.google.firebase:firebase-firestore
#AdditionalJar: com.google.gms:google-services
#AdditionalJar: grpc-core-1.20.0.jar
#AdditionalJar: grpc-protobuf-1.20.0.jar
#AdditionalJar: grpc-okhttp-1.20.0.jar
#AdditionalJar: grpc-android-1.20.0.aar
#AdditionalJar: opencensus-api-0.20.0.jar
#AdditionalJar: grpc-stub-1.20.0.jar
#AdditionalJar: grpc-protobuf-lite-1.20.0.jar
#AdditionalJar: opencensus-contrib-http-util-0.20.0.jar
#AdditionalJar: opencensus-contrib-grpc-metrics-0.20.0.jar
#AdditionalJar: grpc-context-1.20.0.jar
#AdditionalJar: glide-3.8.0.jar
#AdditionalJar: guava-27.1-android.jar
#ExcludeClasses: com.google.guava:guava-jdk5  
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private auth As FirebaseAuth
    Dim Imagen_perfil As String
    Dim fs As Firestore
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

   
    Private inicio_etiqueta As Label
    Private Image_Perfil_View1 As ImageView
    Dim Imagen_perfil As String
    Private btnSignOut As Button
    Private btnloginFacebook As Button
    Private btnlogingogle As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")

    Activity.LoadLayout("inicio")
    'If auth.CurrentUser.IsInitialized Then Auth_SignedIn(auth.CurrentUser)
    fs.Initialize("Firestore",True)
    Dim driver As CollectionReference = fs.collection("Drivers","DriverCollection")
    If driver <> Null Then
        Log("Setting query to get driver DonManfred")
        driver.whereEqualTo("id","DonManfred").limit(1).fetch("DriverFetch")
        wait for DriverFetch_Snapshot(snap As QuerySnapshot)
        Log($"Driver_Snapshot(${snap.Size},${snap})"$)
        Dim meta As SnapshotMetadata = snap.Metadata
        Dim documents As List = snap.Documents
        'Log(documents)
        If documents.IsInitialized Then
            If documents.Size > 0 Then
                For i = 0 To documents.Size-1
                    Dim docsnap As DocumentSnapshot = documents.Get(i)
                    Log("Query4DonManfred DocumentNo: #"&i&": "&docsnap.Id)
                Next
            End If
        Else
            Log("Snapshot does not contain a list of Documents...")
        End If
    End If
   
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub btnlogingogle_Click
    Starter.auth.SignInWithGoogle
End Sub

Sub btnloginFacebook_Click
    Starter.facebook.SignIn
End Sub

Sub btnSignOut_Click
    Starter.auth.SignOutFromGoogle
    Starter.facebook.SignOut
    inicio_etiqueta.Text = "Te esperamos nuevamente!"
    Image_Perfil_View1.Bitmap = Null
End Sub

'Sub Auth_SignedIn (User As FirebaseUser)
'    Log("SignedIn: " & User.DisplayName)
'    inicio_etiqueta.Text = "Hola, Bienvenido " & User.DisplayName
   

'End Sub
Sub SetState
    If Starter.auth.CurrentUser.IsInitialized Then
        Dim usuario As FirebaseUser = Starter.auth.CurrentUser
        inicio_etiqueta.Text = "Hola: " & usuario.DisplayName
        Imagen_perfil=usuario.PhotoUrl
        Dim links As Map
        links.Initialize
        links.Put(Image_Perfil_View1, usuario.PhotoUrl)
        CallSubDelayed2(imageDownLoader, "Download", links)
       
    End If
   
End Sub
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Download the files contained in the addlib folder to C: \ Program Files \ Anywhere Software \ Basic4android \ Libraries
This is NOT the additional libs folder. You should NOT place any Libraries extect the internal libraries here.
Create a new Folder, put them all there. Configure the IDE to use that folder.
Error Maven artifact not found: com.google.protobuf/protobuf-lite
notepakhex042.png
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
What I can do?
It is a bit tricky part/workaround.

copy the com folder to your sdk

Replace "E:\AndroidSDK.Win10\" in the following examples with your SDK-Path

E:\AndroidSDK.Win10\extras\b4a_remote <- Into this folder

Make sure not to have the SDKManager running. Edit the installed-components.txt
E:\AndroidSDK.Win10\extras\b4a_remote\installed-components.txt

and add these lines
B4X:
com.google.protobuf\:protobuf-lite=3.0.1
com.google.guava\:listenablefuture=1.0
com.google.dagger\:dagger=2.17
com.google.auto.value\:auto-value-annotations=1.6.2
 

Attachments

  • com.zip
    346.8 KB · Views: 211
Upvote 0

gregorio_adrian_gimenez

Active Member
Licensed User
Longtime User
it did not work

Organizing libraries. Error
Maven artifact not found: com.google.protobuf/protobuf-lite

copy here the com folder sent --> C:\Android\extras\b4a_remote\com
i modify the installed-components.txt file


Then verify the sdk manager and indicate that it is updated, But it does not work


upload_2019-5-19_20-5-48.png
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
copy here the com folder sent --> C:\Android\extras\b4a_remote\com
do you have now a folder C:\Android\extras\b4a_remote\com\com? this would indicated you copied it wrongly somehow.


check this folder. After copying the com folder it should look like this:
C:\Android\extras\b4a_remote\com\google\protobuf\protobuf-lite\3.0.1\protobuf-lite-3.0.1.jar
 
Upvote 0

gregorio_adrian_gimenez

Active Member
Licensed User
Longtime User
Hi! here C:\Android\extras\b4a_remote\com\google\protobuf\protobuf-lite\3.0.1\protobuf-lite-3.0.1.jar.
it does not work


I see this too, C:\Android\extras\google\m2repository\com\google\auto\value\auto-value-annotations\1.6.3

I also see another google folder, it is a patch that Erel passed by another problem. This will not be complicating?

regards
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Hi! here C:\Android\extras\b4a_remote\com\google\protobuf\protobuf-lite\3.0.1\protobuf-lite-3.0.1.jar.
it does not work
What do you mean with this? Is the file available at this place after you copied the com folder?
Is the ref really inside the installed-components.txt? Upload the file here please.
 
Upvote 0

gregorio_adrian_gimenez

Active Member
Licensed User
Longtime User
hello,
What do you mean with this? Is the file available at this place after you copied the com folder?

yes, it appears as installed but still generates the error when compiling

Is the ref really inside the installed-components.txt? Upload the file here please.

I'm attaching the file.

I also attach images of how the folder is
upload_2019-5-20_20-17-34.png


upload_2019-5-20_20-17-55.png




there is another com folder that was previously in this path C:\Android\extras\google\m2repository\com\google

upload_2019-5-20_20-20-14.png
 

Attachments

  • installed-components.txt
    12.8 KB · Views: 181
Upvote 0

gregorio_adrian_gimenez

Active Member
Licensed User
Longtime User
I replaced the file. But it continues to generate the same error.
Organizing libraries. Error
Maven artifact not found: com.google.protobuf/protobuf-lite
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Is there any chance that i can connect to your pc using AnyDesk to check the configuration by myself? Problem is maybe our different locations (and Timezones)...

All other users of the Firestore Library were able to compile after the installed the com folder in their SDK.

Honestly i am a bit lost why it does not work for you.
 
Upvote 0
Top