我正在将我的本机升级到版本0.60.5
但是我的应用程序在打开时因以下错误而崩溃:
09-05 14:09:03.791 E/AndroidRuntime(15689): FATAL EXCEPTION: main
09-05 14:09:03.791 E/AndroidRuntime(15689): Process: com.vit, PID: 15689
09-05 14:09:03.791 E/AndroidRuntime(15689): java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider" on path: DexPathList[[zip file "/data/app/com.vit-jgrJHorEudfCkM-QiDi6oQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.vit-jgrJHorEudfCkM-QiDi6oQ==/lib/arm, /data/app/com.vit-jgrJHorEudfCkM-QiDi6oQ==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
09-05 14:09:03.791 E/AndroidRuntime(15689): at android.app.ActivityThread.installProvider(ActivityThread.java:6575)
09-05 14:09:03.791 E/AndroidRuntime(15689): at android.app.ActivityThread.installContentProviders(ActivityThread.java:6127)
09-05 14:09:03.791 E/AndroidRuntime(15689): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6037)
09-05 14:09:03.791 E/AndroidRuntime(15689): at android.app.ActivityThread.-wrap1(Unknown Source:0)
09-05 14:09:03.791 E/AndroidRuntime(15689): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
09-05 14:09:03.791 E/AndroidRuntime(15689): at android.os.Handler.dispatchMessage(Handler.java:105)
09-05 14:09:03.791 E/AndroidRuntime(15689): at android.os.Looper.loop(Looper.java:164)
09-05 14:09:03.791 E/AndroidRuntime(15689): at android.app.ActivityThread.main(ActivityThread.java:6938)
09-05 14:09:03.791 E/AndroidRuntime(15689): at java.lang.reflect.Method.invoke(Native Method)
09-05 14:09:03.791 E/AndroidRuntime(15689): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
09-05 14:09:03.791 E/AndroidRuntime(15689): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
09-05 14:09:03.791 E/AndroidRuntime(15689): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider" on path: DexPathList[[zip file "/data/app/com.vit-jgrJHorEudfCkM-QiDi6oQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.vit-jgrJHorEudfCkM-QiDi6oQ==/lib/arm, /data/app/com.vit-jgrJHorEudfCkM-QiDi6oQ==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
09-05 14:09:03.791 E/AndroidRuntime(15689): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
09-05 14:09:03.791 E/AndroidRuntime(15689): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
09-05 14:09:03.791 E/AndroidRuntime(15689): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
09-05 14:09:03.791 E/AndroidRuntime(15689): at android.app.ActivityThread.installProvider(ActivityThread.java:6560)
清单文件中没有<provider>
。
我要附加清单文件和构建Gradel文件:
清单文件:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.vit"
android:versionCode="16"
android:versionName="2.4.1">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="22" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme"
tools:replace="android:appComponentFactory"
android:appComponentFactory="whateverString">
<service android:name="com.evollu.react.fcm.MessagingService" android:enabled="true" android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service android:name="com.evollu.react.fcm.InstanceIdService" android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="io.fabric.ApiKey"
android:value="x"
/>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<service
android:name=".FirebaseServices.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_launcher"/>
<meta-data android:name="com.google.firebase.messaging.default_notification_channel_id"android:value="my_default_channel"/>
<service
android:name=".FirebaseServices.FirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
</application>
</manifest>
我在应用中构建Gradle文件:
apply plugin: "com.android.application"
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js",
enableHermes: true
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "com.vit"
minSdkVersion 19
targetSdkVersion 26
versionCode 16
versionName "2.4.1"
//multiDexEnabled true
ndk {
//abiFilters "armeabi-v7a","arm64-v8a", "x86","x86_64"
abiFilters "armeabi-v7a","x86"
}
}
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-orientation')
compile project(':react-native-device-information')
compile project(':react-native-ble-manager')
compile project(':react-native-fabric')
compile project(':react-native-linear-gradient')
compile project(':react-native-image-crop-picker')
compile project(':react-native-config')
implementation project(':react-native-picker')
implementation project(':react-native-device-info')
implementation project(':react-native-fcm')
implementation project(':react-native-firebase')
implementation project(':react-native-svg')
implementation project(':react-native-vector-icons')
implementation project(':react-native-spinkit')
implementation(project(':react-native-push-notification')) {
exclude group: 'com.google.android.gms'
}
implementation project(':react-native-linear-gradient')
implementation project(':react-native-image-crop-picker')
implementation project(':react-native-config')
implementation project(':react-native-picker-module')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation ("com.google.android.gms:play-services-gcm:16.1.0") {
force = true
}
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation ("com.google.firebase:firebase-messaging:20.0.0")
implementation 'androidx.multidex:multidex:2.0.1'
compile('com.crashlytics.sdk.android:crashlytics:2.9.2@aar') {
transitive = true;
}
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
和我的构建根目录:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.3.1'
}
}
allprojects {
repositories {
// Add jitpack repository (added by react-native-spinkit)
maven { url "https://jitpack.io" }
mavenLocal()
google()
jcenter()
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
ext {
compileSdkVersion = 28
targetSdkVersion = 28
buildToolsVersion = "28.0.3"
supportLibVersion = "28.0.0"
googlePlayServicesVersion = "15.0.1"
oreoEXPERIMENTAL = "yes"
}
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
}
}
}
}
我不使用android studio,因为我的应用程序也在iOS上运行。
我已经看到了解决方案,该方案讨论了in然后的清单,但是我的项目中没有。
任何解决方案或建议都将受到欢迎,我在最后一天一直试图解决此问题,但没有任何反应。
谢谢!