Google服务版本出错

时间:2017-08-19 14:18:45

标签: android firebase firebase-storage

即使在更新版本后,只要构建了gradle,就会继续弹出相同的错误。

项目基础gradle

document.getElementById("findbutton").addEventListener("click",  function(e){
    var FindNSN = document.getElementById('search-input').value;
    firebase.auth().onAuthStateChanged((user) => {
        if (user) {
            database = firebase.database();
            var uid = firebase.auth().currentUser.uid;
            console.log(FindNSN);
            var searchref = database.ref('/Businesses/' + uid + '/Inventory/' + FindNSN);
            searchref.on('value', search,  errData);  // this is dashboard.js:363
        }
    })
})

function search(data){
    var container = document.getElementById('searchresult'); 
    var uid = firebase.auth().currentUser.uid;
    container.innerHTML = '';
    data.forEach(function(SearchSnap) {
        var key = SearchSnap.key;
        var Results = SearchSnap.val();
        console.log(Results);
        var ResultCard = `
         <li>
                <div class="collapsible-header"><i class="mdi-navigation-chevron-right"></i><a name="987"/>${Results.ProductName}</a></div>
                <div class="collapsible-body"><p>${Results.ProductDescription}</p></div>
         </li>
        `;
        container.innerHTML += ResultCard;
      })
}

** App base gradle **

 Uncaught (in promise) Error: Query.on failed: Second argument must be a valid function.

at A (firebase-database.js:44)
at U.g.gc (firebase-database.js:170)
at firebase.auth.onAuthStateChanged (dashboard.js:363)
at firebase-auth.js:202
at <anonymous>
A @ firebase-database.js:44

g.gc @ firebase-database.js:170

firebase.auth.onAuthStateChanged @ dashboard.js:363

(anonymous) @ firebase-auth.js:202

,错误如下所示: -

  

错误:任务&#39;:app:processDebugGoogleServices&#39;执行失败。   请修改版本冲突,方法是更新google-services插件的版本(https://bintray.com/android/android-tools/com.google.gms.google-services/提供有关最新版本的信息)或将com.google.android.gms版本更新为10.0.1。

请帮我解决这个问题。

1 个答案:

答案 0 :(得分:0)

您的所有firebase版本应该相同。

compile 'com.google.firebase:firebase-database:9.2.0'

更新它

compile 'com.google.firebase:firebase-database:10.0.1'