How i Can Initialize Firebase in cn1?

33 views
Skip to first unread message

bedsp...@gmail.com

unread,
Apr 4, 2019, 3:31:12 PM4/4/19
to CodenameOne Discussions
hi, 
i need to add firebase to my cn1app with these attributes
buildscript {
 
// ...
  dependencies
{
   
// ...
   
// Add the following line:
    classpath
'com.google.gms:google-services:4.2.0'  // Google Services plugin
 
}
}
apply plugin: 'com.android.application'

android
{
 
// ...
}

// Add the following line to the bottom of the file:
apply plugin
: 'com.google.gms.google-services'  // Google Play services Gradle plugin
apply plugin: 'com.android.application'

android
{
 
// ...
}

// Add the following line to the bottom of the file:
apply plugin
: 'com.google.gms.google-services'  // Google Play services Gradle plugin




apply plugin: 'com.android.application'

android
{
 
// ...
}

// Add the following line to the bottom of the file:
apply plugin: 'com.google.gms.google-services'  // Google Play services Gradle plugin 


dependencies {
 
// ...
 implementation
'com.google.firebase:firebase-core:16.0.8'

 
// Getting a "Could not find" error? Make sure that you've added
 
// Google's Maven repository to your root-level build.gradle file
}




i tried to add these hints
 android.gradlePlugin=apply plugin: 'com.google.gms.google-services';
android
.gradleDep=compile 'com.google.gms:google-services:4.2.0'; implementation 'com.google.firebase:firebase-core:16.0.8';

but i get this error
FAILURE: Build failed with an exception.

* Where:
Build file '/tmp/build812279652249867934xxx/MyApplication/build.gradle' line: 2

* What went wrong:
A problem occurred evaluating root project 'MyApplication'.
> Plugin with id 'com.google.gms.google-services' not found.



how i can fix it?
how i can add classpath dependencies in gradel project file?
error - 2019-04-04T115045.587.txt

Shai Almog

unread,
Apr 4, 2019, 11:49:42 PM4/4/19
to CodenameOne Discussions
Hi,
firebase is added implicitly when using push notification build hints.

Readily Speck

unread,
Apr 5, 2019, 5:23:27 AM4/5/19
to codenameone...@googlegroups.com
i need to use firebase in native interface code,
i tried adding all hint required for push but the firebase was not added and can't import in native code any class related it 
i don't need use push notification 
i need to create chat with firebase and to do that i need to do import some class in firebase 😑

On Thu, Apr 4, 2019 at 8:49 PM Shai Almog <shai....@gmail.com> wrote:
Hi,
firebase is added implicitly when using push notification build hints.

--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/qW7rnfVULko/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/c7d84342-7c13-409a-916a-a100461d4e67%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shai Almog

unread,
Apr 6, 2019, 12:49:03 AM4/6/19
to CodenameOne Discussions
I haven't tried this myself as we don't use firebase and had really bad experience with Google PaaS/SaaS products in the past. But a user said that he was able to use android.messagingService=fcm to include most of the firebase dependencies automatically. Not sure if it will include the things you need in it as it was designed for FCM but it might be a good starting point.

I would strongly recommend avoiding firebase and using websockets which are simple to use, cheaper and better in general. They don't have the risk of sudden cost surprises either.
Reply all
Reply to author
Forward
0 new messages