我突然收到此错误。我没有删除任何文件。
我所做的是,我签出了一个github
分支(我在两周前就在该分支上工作。那时工作还不错),在3.json
中做了一些修改。自从我将gradle
从默认发行版更改为本地发行版以来,指定的gradle
发行版似乎不包含gradle
发行版。然后提交代码。用开发分支对其进行基础调整。然后,当我运行它时,我得到了这个错误。然后我签出了开发部门。我再次遇到相同的错误。我的队友没有收到此错误。因此很明显,该代码是正确的。
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/Preconditions;
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:1050)
at android.app.ActivityThread.installProvider(ActivityThread.java:5153)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
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)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.Preconditions" on path: DexPathList[[zip file "/data/app/com.zopsmart.picking-2/base.apk", zip file "/data/app/com.zopsmart.picking-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.zopsmart.picking-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.zopsmart.picking-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.zopsmart.picking-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.zopsmart.picking-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.zopsmart.picking-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.zopsmart.picking-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.zopsmart.picking-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.zopsmart.picking-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.zopsmart.picking-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.zopsmart.picking-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.zopsmart.picking-2/lib/arm, /data/app/com.zopsmart.picking-2/base.apk!/lib/armeabi, /data/app/com.zopsmart.picking-2/split_lib_dependencies_apk.apk!/lib/armeabi, /data/app/com.zopsmart.picking-2/split_lib_slice_0_apk.apk!/lib/armeabi, /data/app/com.zopsmart.picking-2/split_lib_slice_1_apk.apk!/lib/armeabi, /data/app/com.zopsmart.picking-2/split_lib_slice_2_apk.apk!/lib/armeabi, /data/app/com.zopsmart.picking-2/split_lib_slice_3_apk.apk!/lib/armeabi, /data/app/com.zopsmart.picking-2/split_lib_slice_4_apk.apk!/lib/armeabi, /data/app/com.zopsmart.picking-2/split_lib_slice_5_apk.apk!/lib/armeabi, /data/app/com.zopsmart.picking-2/split_lib_slice_6_apk.apk!/lib/armeabi, /data/app/com.zopsmart.picking-2/split_lib_slice_7_apk.apk!/lib/armeabi, /data/app/com.zopsmart.picking-2/split_lib_slice_8_apk.apk!/lib/armeabi, /data/app/com.zopsmart.picking-2/split_lib_slice_9_apk.apk!/lib/armeabi, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:1050)
at android.app.ActivityThread.installProvider(ActivityThread.java:5153)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
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)
Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.common.internal.Preconditions
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
I/Process: Sending signal. PID: 7160 SIG: 9
Application terminated.
应用级gradle文件
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
defaultConfig {
applicationId "XXXXXXXXXX"
minSdkVersion 15
targetSdkVersion 27
versionCode 29
versionName "1.1.5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
multiDexEnabled true
buildConfigField("String", "host", "\"https://XXXXXXXXXX.com/\"")
}
/*splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a', 'x86_64'
universalApk true
}
}*/
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
}
}
dependencies {
implementation fileTree(include: ['*.jar', '.so'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
// Constraint Layout
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
// Room Database
implementation 'android.arch.persistence.room:runtime:1.1.0'
implementation 'android.arch.persistence.room:rxjava2:1.1.0'
annotationProcessor "android.arch.persistence.room:compiler:1.1.0"
// Dagger 2 Dependency Injection
implementation 'com.google.dagger:dagger:2.13'
annotationProcessor 'com.google.dagger:dagger-compiler:2.13'
// Glide
implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
// CardView
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'android.arch.lifecycle:extensions:1.1.1'
// RxJava
implementation 'io.reactivex.rxjava2:rxjava:2.1.1'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
// ViewModel and LiveData
implementation 'android.arch.lifecycle:extensions:1.1.1'
// RxJava support for Room (use 1.1.0-alpha1 for latest alpha)
implementation 'android.arch.persistence.room:rxjava2:1.1.0'
// ReactiveStreams support for LiveData
implementation 'android.arch.lifecycle:reactivestreams:1.1.1'
// RecyclerView
implementation 'com.android.support:recyclerview-v7:27.1.1'
// Add Dagger dependencies
implementation 'com.google.dagger:dagger:2.13'
annotationProcessor 'com.google.dagger:dagger-compiler:2.13'
//Circle IV library
implementation 'de.hdodenhof:circleimageview:2.2.0'
//Navigation Drawe
implementation 'com.android.support:design:27.1.1'
// GSON
implementation 'com.google.code.gson:gson:2.8.1'
// OkHttpClient
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
// Zxing for scanning
implementation 'com.journeyapps:zxing-android-embedded:3.0.2@aar'
implementation 'com.google.zxing:core:3.2.0'
// EPSON printer
implementation files('libs/ePOS2.jar')
implementation files('libs/ePOSEasySelect.jar')
//crashlytics
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
// WorkManager
implementation 'android.arch.work:work-runtime:1.0.0-alpha09'
// Bugsnag
implementation 'com.bugsnag:bugsnag-android:4.+'
implementation files('libs/ZSDK_ANDROID_API.jar')
implementation 'com.fasterxml.jackson.core:jackson-databind:2.3.2'
}
apply plugin: 'com.google.gms.google-services'
清单文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="XXXXXXXXXX">
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<application
android:name=".XXXXXXXXXX"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_circle"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".view.SplashActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".view.HomeActivity"
android:screenOrientation="portrait" />
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />
</application>
</manifest>
答案 0 :(得分:1)
在应用程序标签内的manifiedt文件中使用此代码。
<application>
.....
.....
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
</application>