由于Firebase,我的应用在启动时崩溃,我不知道为什么。我在我的应用程序OneSignal中使用。我收到此错误消息:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tosi.man, PID: 1086
java.lang.NoSuchMethodError: No static method isDeviceProtectedStorage(Landroid/content/Context;)Z in class Landroid/support/v4/content/ContextCompat; or its super classes (declaration of 'android.support.v4.content.ContextCompat' appears in /data/app/com.tosi.man-2/split_lib_dependencies_apk.apk)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1769)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1744)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5990)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5561)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5500)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1595)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:208)
at android.app.ActivityThread.main(ActivityThread.java:6267)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
这是我的build.gradle(模块应用程序):
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.tosi.man"
manifestPlaceholders = [
onesignal_app_id : 'b53b7c1c-c8c2-4646-a1e8-ea7b4c5d2876',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE'
]
minSdkVersion 15
targetSdkVersion 23
versionCode 18
versionName "2.0.5"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
multiDexEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}
allprojects {
repositories {
flatDir {
dirs 'libs'
}
google()
jcenter()
maven {
url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
}
maven {
url 'http://swisscodemonkeys.github.io/appbrain-sdk/maven'
}
}
}
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.10.2'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
dependencies {
implementation 'com.google.firebase:firebase-core:11.0.4'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services-gcm:11.0.4'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:mediarouter-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:multidex:1.0.3'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.appbrain:appbrain-sdk:+@aar'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'org.xwalk:xwalk_core_library:10.39.235.15'
compile 'com.google.android.gms:play-services-cast-framework:11.0.4'
compile 'com.android.support:support-vector-drawable:23.4.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
这是我的build.gradle(Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
你能帮帮我吗?我不知道为什么我得到这个错误可能我有不良版本的依赖项。非常感谢你。
答案 0 :(得分:-1)
更新一些事情