应用程序不断崩溃,任何人都可以帮忙吗?首先是dex错误我添加了依赖项并启用了multiDex但仍然没有运气..
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.parth.newapp1, PID: 21233
java.lang.NoSuchMethodError: No direct method <init>(Lcom/google/android/gms/internal/zzbpa;)V in class Lcom/google/android/gms/internal/zzbra; or its super classes (declaration of 'com.google.android.gms.internal.zzbra' appears in /data/app/com.example.parth.newapp1-2/split_lib_dependencies_apk.apk:classes6.dex)
at com.google.android.gms.internal.zzbpj.<init>(Unknown Source)
at com.google.android.gms.internal.zzbpl.zzb(Unknown Source)
at com.google.android.gms.internal.zzbpl.zza(Unknown Source)
at com.google.firebase.database.FirebaseDatabase.zzWG(Unknown Source)
at com.google.firebase.database.FirebaseDatabase.getReference(Unknown Source)
at com.example.parth.newapp1.MainActivity.onCreate(MainActivity.java:29)
at android.app.Activity.performCreate(Activity.java:6323)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)
at android.app.ActivityThread.access$900(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1347)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5451)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
MainActivity上的第29行: mDatabase = FirebaseDatabase.getInstance()。getReference.child(“Blog”);
摇篮:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.parth.newapp1"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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'
})
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
答案 0 :(得分:0)
com.firebaseui:firebase-ui-database:1.2.0将具有传递依赖关系 com.google.firebase:火力数据库:10.0.1&#39;或者&com; google.firebase:firebase-storage:10.0.1会导致重复输入问题。因此,请保留您需要的实际依赖关系并删除其他依赖项。