我创建了一个android项目。当我运行或构建apk时,它将显示错误。如何解决这个问题呢?一切都很好。当我同步项目时,它将正常运行。但是,当我尝试在模拟器上运行此程序或构建APK时,它显示以下错误。
错误
错误:无法访问zzbej类文件 找不到com.google.android.gms.internal.zzbej
build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }//for android O
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://github.com/leonardocardoso/mvn-repo/raw/master/maven-deploy' }
}
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.test.test"
resValue 'string', 'package_name', applicationId
minSdkVersion 16
targetSdkVersion 26
versionCode 54
versionName "1.5.3"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
renderscriptTargetApi 26
renderscriptSupportModeEnabled true
}
lintOptions {
disable 'RestrictedApi'
}//this until Google release a fix .bottomsheet super
dexOptions {
preDexLibraries true
javaMaxHeapSize "4g"
dexInProcess = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles 'proguard-rules.txt'
}
debug {
minifyEnabled false
shrinkResources false
renderscriptDebuggable false
jniDebuggable false
proguardFiles 'proguard-rules.txt'
signingConfig signingConfigs.debug
}
}
packagingOptions {
exclude '.readme'
exclude 'LICENSE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/README.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/MANIFEST.MF'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
def supportLibsVer = "26.+"
def googlePlayServicesVer = "11.6.0"
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation "com.android.support:appcompat-v7:$supportLibsVer"
implementation "com.android.support:cardview-v7:$supportLibsVer"
implementation "com.android.support:design:$supportLibsVer"
implementation "com.android.support:recyclerview-v7:$supportLibsVer"
implementation "com.android.support:palette-v7:$supportLibsVer"
implementation "com.google.android.gms:play-services-ads:$googlePlayServicesVer"
implementation "com.google.android.gms:play-services-drive:$googlePlayServicesVer"
implementation "com.google.firebase:firebase-messaging:$googlePlayServicesVer"
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'jp.wasabeef:glide-transformations:2.0.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'jp.wasabeef:picasso-transformations:2.1.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.6.0'
implementation 'com.squareup.okhttp3:okhttp:3.8.1'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.2'
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'com.github.hani-momanii:SuperNova-Emoji:1.1'
implementation 'me.leolin:ShortcutBadger:1.1.16@aar'
implementation('io.socket:socket.io-client:1.0.0') {
// excluding org.json which is provided by Android
exclude group: 'org.json', module: 'json'
}
implementation('com.github.ozodrukh:CircularReveal:2.0.1@aar') {
transitive = true;
}
implementation 'joda-time:joda-time:2.9.7'
implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true;
}
implementation 'com.googlecode.libphonenumber:libphonenumber:8.5.2'
implementation 'com.orhanobut:logger:1.15'
implementation 'io.pristine:libjingle:11139@aar'
implementation 'pl.bclogic:pulsator4droid:1.0.3'
implementation 'com.github.yalantis:ucrop:2.2.1-native'
implementation 'org.jsoup:jsoup:1.8.3' // required for link preview
implementation 'com.leocardz:link-preview:1.2.2@aar'
implementation 'com.facebook.network.connectionclass:connectionclass:1.0.1'
implementation 'com.facebook.android:account-kit-sdk:4.+'
implementation 'com.google.android.gms:play-services-ads:11.6.0'
}
项目摇篮 build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath "io.realm:realm-gradle-plugin:4.2.0"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
您能帮我解决这个问题吗?