ここでは、私は私のプロジェクトをビルドするとき、私は取得していますエラーです:重複エントリ:COM /グーグル/アンドロイド/ GMS /内部/ zzahl.class
Error:Execution failed for task ':transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/internal/zzahl.class
私が何であるかを見つけ出すように見えることはできませんエラーを引き起こして、私はそれが私のgradleやJavaの活動でうんざりしていると思う。
のGradle:ここでは、コードです
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.13.0' // version plugin support
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:3.0.0'
}
}
plugins {
id "org.sonarqube" version "2.1" // https://plugins.gradle.org/plugin/org.sonarqube
}
apply plugin: 'com.android.application'
apply plugin: 'com.github.ben-manes.versions' // ./gradlew dependencyUpdates -Drevision=release
apply plugin: 'sonar-runner'
apply plugin: 'android-apt'
apply plugin: 'com.google.gms.google-services'
repositories {
jcenter()
}
def versionMajor = 1
def versionMinor = 0
def versionPatch = 0
def versionBuild = 0
def versionMajorMinorPatchBuild = "${versionMajor}.${versionMinor}.${versionPatch}.${versionBuild}"
def versionString = "${versionMajor}.${versionMinor}.${versionPatch}"
def versionStringFull = "${versionMajor}.${versionMinor}.${versionPatch}.${versionBuild}"
android {
compileSdkVersion 25
buildToolsVersion "24.0.3"
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "skipasses.android.abc.123.skipasses"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
// set dummy signing values if not defined in ~/.gradle/gradle.properties
if (!project.hasProperty('SkiPassKeyStoreFile')) {
println "Using dummy signing values"
project.ext.setProperty('SkiPassKeyStoreFile', 'dummy.keystore')
project.ext.setProperty('SkiPassKeyStorePassword', 'dummy!')
project.ext.setProperty('SkiPassKeyAlias', 'dummy')
project.ext.setProperty('SkiPassKeyPassword', 'dummy!')
}
// defined on the build server in the /usr/share/tomcat/.gradle/gradle.properties
signingConfigs {
release {
storeFile file(SkiPassKeyStoreFile)
storePassword SkiPassKeyStorePassword
keyAlias SkiPassKeyAlias
keyPassword SkiPassKeyPassword
}
lwa {
storeFile file('keystore.jks')
keyAlias 'androiddebugkey'
keyPassword 'android'
storePassword 'android'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "String", "VERSION_NAME_FULL", "\"${versionString}\""
signingConfig signingConfigs.release
}
debug {
versionNameSuffix '-DEV'
buildConfigField "String", "VERSION_NAME_FULL", "\"${versionStringFull}${versionNameSuffix}\""
}
beta {
versionNameSuffix '-BETA'
//noinspection GroovyAssignabilityCheck
signingConfig android.signingConfigs.debug
zipAlignEnabled true
buildConfigField "String", "VERSION_NAME_FULL", "\"${versionStringFull}${versionNameSuffix}\""
}
}
lintOptions {
abortOnError false
}
}
ext {
// versions for libraries that multiple dependencies
supportLibVersion = '25.0.0'
dagger = '2.7'
butterknife = '8.4.0'
pocketknife = '3.2.1'
}
dependencies {
// Support Libraries
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
// Dependency Injection dependencies
compile "com.google.dagger:dagger:${dagger}"
apt "com.google.dagger:dagger-compiler:${dagger}"
// View Binding
compile "com.jakewharton:butterknife:${butterknife}"
apt "com.jakewharton:butterknife-compiler:${butterknife}"
compile "com.vikingsen:pocketknife-core:${pocketknife}"
apt "com.vikingsen:pocketknife-compiler:${pocketknife}"
// Unit Testing
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// Firebase
compile 'com.google.firebase:firebase-auth:9.8.0'
compile 'com.firebaseui:firebase-ui-database:0.6.1'
compile 'com.firebaseui:firebase-ui-auth:0.6.1'
compile 'com.google.firebase:firebase-core:9.8.0'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.android.support:recyclerview-v7:25.0.0'
testCompile 'junit:junit:4.12'
provided 'javax.annotation:jsr250-api:1.0'
}
sonarqube { //./gradlew sonarqube aDebug
properties {
if (!project.hasProperty("abc123SonarHostUrl")) {
println '!!!! ABC123 Sonar properties must be set in your gradle.properties !!!!'
return
}
// Project Information
property "sonar.projectKey", "SkiPasses"
property "sonar.projectName", "SkiPasses"
property "sonar.projectVersion", versionMajorMinorPatchBuild
// Sonar Information
property "sonar.host.url", abcSonarHostUrl
property "sonar.jdbc.url", abcSonarJdbcUrl
property "sonar.jdbc.driverClassName", abcSonarJdbcDriver
property "sonar.jdbc.username", abcSonarUsername
property "sonar.jdbc.password", abcSonarPassword
properties["sonar.sources"] = "src/main" //android.sourceSets.main.java.srcDirs
properties["sonar.tests"] = android.sourceSets.androidTest.java.srcDirs
if (file("build/intermediates/classes/debug").exists()) {
properties["sonar.binaries"] = [file("build/intermediates/classes/debug")]
}
if (file("build/intermediates/classes/beta").exists()) {
properties["sonar.binaries"] = [file("build/intermediates/classes/beta")]
}
}
}
と活動:
package abc123.android.abc.123.skipasses.ui.activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import com.google.firebase.auth.FirebaseAuth;
import abc123.android.abc.123.skipasses.R;
public class DashboardActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dashboard);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
//Todo: figure out why the BuildConfig is not being fetched
// TextView textView = (TextView) findViewById(R.id.version_text);
// textView.setText(getString(R.string.version_number, BuildConfig.VERSION_NAME));
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onNavigationItemSelected(MenuItem item) {
int id = item.getItemId();
//TODO Create fragments for each menu item
if (id == R.id.nav_my_reservations) {
} else if (id == R.id.nav_make_reservation) {
} else if (id == R.id.nav_settings) {
} else if (id == R.id.nav_log_out) {
FirebaseAuth.getInstance().signOut();
Intent loginIntent = new Intent(DashboardActivity.this, LoginActivity.class);
startActivity(loginIntent);
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
私はクリーンビルドをやってみました。私は重複したライブラリを見つけることができません。私は、バージョン番号の中にプレイサービスとファイアベースが並んでいない場所はどこにあるのか分かりません。私はこのエラーがどのように起こっているのかわかりません。どんな指導も高く評価されます。
ファイルの末尾に適用プラグイン 'com.google.gms.google-services'を追加します。 –