我浏览了整个网络,可能的解决方案是使每个firebase依赖项的版本相同,但这样做会引发同样的错误。
Process: com.bookbud.hp.firebasebook, PID: 5025 java.lang.NoSuchMethodError:
No virtual method zzUU()Z in class Lcom/google/firebase/FirebaseApp; or its
super classes (declaration of 'com.google.firebase.FirebaseApp' appears in
/data/app/com.bookbud.hp.firebasebook1/split_lib_dependencies_apk.apk:
classes5.dex) at
com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source)at
com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source)at
com.bookbud.hp.firebasebook.MainActivity.onCreate(MainActivity.java:77)at
android.app.Activity.performCreate(Activity.java:6760)at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1134)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2681)at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2814)at
android.app.ActivityThread.-wrap12(ActivityThread.java)at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527)at
android.os.Handler.dispatchMessage(Handler.java:102)at
android.os.Looper.loop(Looper.java:154)at
android.app.ActivityThread.main(ActivityThread.java:6290)at
java.lang.reflect.Method.invoke(Native Method)at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:
886)at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
主要活动。为简单起见,省略了import语句和其他不必要的代码。
package com.bookbud.hp.firebasebook;
import android.os.Handler;//others are also included
public class MainActivity extends AppCompatActivity implements
SearchView.OnQueryTextListener,SwipeRefreshLayout.OnRefreshListener{
private String n;
private String c;
private String a;
private String cc;
private String r;
private String cn;
private String e;
private String p;
private String d;
private String i;
private String contact;
private String email;
private String ed;
private String pubi;
private AdView mAdView;
private SearchView mSearchView;
private ListView listView ;
private ArrayList<book> b;
private SwipeRefreshLayout swipeRefreshLayout;
boolean doubleBackToExitPressedOnce = false;
private ShareActionProvider mShareActionProvider;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.word_list);
request.isTestDevice(MainActivity.this);
mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
listView = (ListView) findViewById(R.id.listview_with_fab);
mSearchView = (SearchView) findViewById(R.id.searchView1);
b = new ArrayList<book>();
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
swipeRefreshLayout.setOnRefreshListener(this);
swipeRefreshLayout.setRefreshing(true);
DatabaseReference connectedRef =
FirebaseDatabase.getInstance().getReference(".info/connected");
依赖关系,都是相同的版本。我不认为我错过任何一个。
compile 'com.google.android.gms:play-services-ads:10.2.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-ads:10.2.0'
compile 'com.google.firebase:firebase-database:10.2.0'
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-appindexing:10.2.0'
compile 'com.google.firebase:firebase-storage:10.2.0'
compile 'com.google.firebase:firebase-auth:10.2.0'
答案 0 :(得分:1)
您的play-services-ads版本为10.2.1,但您的firebase-ads版本为10.2.0。
他们需要是相同的版本。