eddydn / ChatApp

First Commit
59 stars 74 forks source link

Error: Constructor FirebaseListAdapter in class FirebaseListAdapter cannot be applied #2

Open Abhilashken opened 6 years ago

Abhilashken commented 6 years ago

https://github.com/eddydn/ChatApp/blob/400d899c6521df6622fdd115f8520a97b1de21c9/app/src/main/java/dev/edmt/chatapp/MainActivity.java#L124

I am facing an error in my code adapter= new FirebaseListAdapter(this,ChatMessage.class,R.layout.list_item,FirebaseDatabase.getInstance().getReference()) {

Error: constructor FirebaseListAdapter in class FirebaseListAdapter cannot be applied to given types; required: FirebaseListOptions found: MainActivity,Class,int,DatabaseReference reason: actual and formal argument lists differ in length where T is a type-variable:T extends Object declared in class FirebaseListAdapter

my build.gradle(app) has 'com.firebaseui:firebase-ui:3.1.2' version of firebase ui.

Fazryan commented 6 years ago

and me too, get problem like you sir, no update already?

Shadowrs commented 6 years ago

@Abhilashken @Fazryan

Mine works fine, using an older firebase-ui version of 0.6.2:

repositories {
    maven { url 'https://jitpack.io' }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //noinspection GradleCompatible
    compile 'com.android.support:appcompat-v7:26.1.0'
    testCompile 'junit:junit:4.12'

    //Add Library
    compile 'com.android.support:design:26.1.0'
    compile 'com.firebaseui:firebase-ui:0.6.2'
    compile 'com.google.gms:google-services:3.1.1'
    compile 'com.github.hani-momanii:SuperNova-Emoji:1.1'
}

Hope that helps. P.S the youtube tutorial for this code for anyone looking in future

Fazryan commented 6 years ago

Thanks for the reply sir, I'll try this step :)

2018-03-21 19:10 GMT+07:00 Jak notifications@github.com:

@Abhilashken https://github.com/abhilashken @Fazryan https://github.com/fazryan

Mine works fine, using an older firebase-ui version of 0.6.2:

repositories { maven { url 'https://jitpack.io' } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) //noinspection GradleCompatible compile 'com.android.support:appcompat-v7:26.1.0' testCompile 'junit:junit:4.12'

//Add Library
compile 'com.android.support:design:26.1.0'
compile 'com.firebaseui:firebase-ui:0.6.2'
compile 'com.google.gms:google-services:3.1.1'
compile 'com.github.hani-momanii:SuperNova-Emoji:1.1'

}

Hope that helps

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/eddydn/ChatApp/issues/2#issuecomment-374916120, or mute the thread https://github.com/notifications/unsubscribe-auth/AUXVcVzpVfkp3gzANHncLbZRq71tRn0qks5tgkNKgaJpZM4RM-7h .

Fazryan commented 6 years ago

finally after I update with the code you give my application, the problem is solved thank you very much sir!

2018-03-22 9:03 GMT+07:00 Fazryan Zyan fazryanzyan@gmail.com:

Thanks for the reply sir, I'll try this step :)

2018-03-21 19:10 GMT+07:00 Jak notifications@github.com:

@Abhilashken https://github.com/abhilashken @Fazryan https://github.com/fazryan

Mine works fine, using an older firebase-ui version of 0.6.2:

repositories { maven { url 'https://jitpack.io' } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) //noinspection GradleCompatible compile 'com.android.support:appcompat-v7:26.1.0' testCompile 'junit:junit:4.12'

//Add Library
compile 'com.android.support:design:26.1.0'
compile 'com.firebaseui:firebase-ui:0.6.2'
compile 'com.google.gms:google-services:3.1.1'
compile 'com.github.hani-momanii:SuperNova-Emoji:1.1'

}

Hope that helps

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/eddydn/ChatApp/issues/2#issuecomment-374916120, or mute the thread https://github.com/notifications/unsubscribe-auth/AUXVcVzpVfkp3gzANHncLbZRq71tRn0qks5tgkNKgaJpZM4RM-7h .

Shadowrs commented 6 years ago

For anyone in the future, here's the code to replace the FirebaseListAdapter initializer method deprecated after com.firebaseui:firebase-ui:0.6.2

build.gradle: (module: app)


    //noinspection GradleCompatible
    implementation 'com.google.firebase:firebase-messaging:11.8.0'
    implementation 'com.firebaseui:firebase-ui:3.2.2'
    implementation 'com.google.gms:google-services:3.2.0'
    implementation 'com.github.hani-momanii:SuperNova-Emoji:1.1'
    implementation 'com.google.firebase:firebase-core:11.8.0'
    implementation 'com.google.android.gms:play-services:11.8.0'

build.gradle (project root):


buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.2.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
}

Adapter:


        Query query = FirebaseDatabase.getInstance().getReference().child("chats").limitToLast(50);
        FirebaseListOptions<ChatMessage> options = new FirebaseListOptions.Builder<ChatMessage>().setQuery(query, ChatMessage.class).setLayout(R.layout.chat_list_item).build();
        FirebaseListAdapter<ChatMessage> adapter = new FirebaseListAdapter<ChatMessage>(options)

Proof:

img

NitikeshDubey011 commented 6 years ago

Thanks buddy @Shadowrs

brownstic commented 5 years ago

ChatApp/app/src/main/java/dev/edmt/chatapp/MainActivity.java

Line 124 in 400d899 adapter = new FirebaseListAdapter(this,ChatMessage.class,R.layout.list_item,FirebaseDatabase.getInstance().getReference())

I am facing an error in my code adapter= new FirebaseListAdapter(this,ChatMessage.class,R.layout.list_item,FirebaseDatabase.getInstance().getReference()) {

Error: constructor FirebaseListAdapter in class FirebaseListAdapter cannot be applied to given types; required: FirebaseListOptions found: MainActivity,Class,int,DatabaseReference reason: actual and formal argument lists differ in length where T is a type-variable:T extends Object declared in class FirebaseListAdapter

my build.gradle(app) has 'com.firebaseui:firebase-ui:3.1.2' version of firebase ui.

Close this issue

apurvas07 commented 4 years ago

thanks for posting it here :)