2016-01-04 333 views
0

当我尝试运行我的android应用程序时,它给了我下面的error.this是一个WordPress移动应用程序。我更新了我的错误和我的构建gradle。请看看给我一个解决方案。Gradle Build Error - Android Studio

Error:A problem occurred configuring project ':WordPress'. 
> Could not resolve all dependencies for configuration ':WordPress:classpath'. 
    > Could not resolve io.fabric.tools:gradle:1.+. 
    Required by: 
     WordPress-Android-develop:WordPress:unspecified 
     > Could not resolve io.fabric.tools:gradle:1.+. 
     > Failed to list versions for io.fabric.tools:gradle. 
      > Unable to load Maven meta-data from https://jcenter.bintray.com/io/fabric/tools/gradle/maven-metadata.xml. 
       > Could not GET 'https://jcenter.bintray.com/io/fabric/tools/gradle/maven-metadata.xml'. 
        > Connection to https://jcenter.bintray.com refused 
     > Could not resolve io.fabric.tools:gradle:1.+. 
     > Failed to list versions for io.fabric.tools:gradle. 
      > Unable to load Maven meta-data from https://maven.fabric.io/repo/io/fabric/tools/gradle/maven-metadata.xml. 
       > Could not GET 'https://maven.fabric.io/repo/io/fabric/tools/gradle/maven-metadata.xml'. 
        > Connection to https://maven.fabric.io refused 

这是我完整的build.Gradle。

buildscript { 
    repositories { 
     jcenter() 
     maven { url 'https://maven.fabric.io/repo' } 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:1.5.0' 
     classpath 'com.github.nrudenko:gradle-android-cq-plugin:0.1+' 
     classpath 'io.fabric.tools:gradle:1.+' 
    } 
} 

repositories { 
    jcenter() 
    maven { url 'http://wordpress-mobile.github.io/WordPress-Android' } 
    maven { url 'https://maven.fabric.io/repo' } 
} 

apply plugin: 'com.android.application' 
apply plugin: 'android-cq' 
apply plugin: 'io.fabric' 

android { 
    useLibrary 'org.apache.http.legacy' 

    dexOptions { 
     jumboMode = true 
    } 

    compileSdkVersion 23 
    buildToolsVersion "23.0.2" 

    defaultConfig { 
     applicationId "org.wordpress.android" 
     versionName "4.9-rc-4" 
     versionCode 231 
     minSdkVersion 14 
     targetSdkVersion 23 

     buildConfigField "String", "APP_PN_KEY", "\"org.wordpress.android.playstore\"" 
    } 

    productFlavors { 
     vanilla {} 

     zbetagroup { 
      buildConfigField "String", "APP_PN_KEY", "\"org.wordpress.android.beta.build\"" 
      applicationId "org.wordpress.android.beta" 
     } 
    } 

    buildTypes { 
     release { 
      // Proguard is only used to fix an issue with some Samsung device 
      // https://github.com/wordpress-mobile/WordPress-Android/issues/2151 
      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg' 
     } 

     debug { 
      buildConfigField "String", "APP_PN_KEY", "\"org.wordpress.android.debug.build\"" 
      ext.enableCrashlytics = false 
     } 
    } 
} 

dependencies { 
    compile 'com.crashlytics.sdk.android:crashlytics:2.2.2' 

    // Provided by maven central 
    compile ('org.wordpress:mediapicker:1.2.4') { 
     exclude group:'com.android.support' 
    } 
    compile 'com.google.code.gson:gson:2.2.2' 
    compile 'org.ccil.cowan.tagsoup:tagsoup:1.2.1' 
    compile 'com.android.support:support-v13:23.1.1' 
    compile 'com.android.support:appcompat-v7:23.1.1' 
    compile 'com.android.support:cardview-v7:23.1.1' 
    compile 'com.android.support:recyclerview-v7:23.1.1' 
    compile 'com.android.support:design:23.1.1' 
    compile 'com.google.android.gms:play-services-gcm:8.3.0' 
    compile 'com.github.chrisbanes.photoview:library:1.2.4' 
    compile 'com.helpshift:android-aar:3.12.0' 
    compile 'de.greenrobot:eventbus:2.4.0' 
    compile 'com.automattic:rest:1.0.2' 
    compile 'org.wordpress:graphview:3.4.0' 
    compile 'org.wordpress:persistentedittext:1.0.1' 

    androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.0' 
    androidTestCompile 'org.objenesis:objenesis:2.1' 
    androidTestCompile 'org.mockito:mockito-core:+' 

    // Provided by the WordPress-Android Repository 
    compile 'org.wordpress:drag-sort-listview:0.6.1' // not found in maven central 
    compile 'org.wordpress:slidinguppanel:1.0.0' // not found in maven central 
    compile 'org.wordpress:passcodelock:1.1.0' 
    compile 'org.wordpress:emailchecker:0.3' 

    // Simperium 
    compile 'com.simperium.android:simperium:0.6.6' 

    releaseCompile project(path:':libs:utils:WordPressUtils', configuration: 'release') 
    debugCompile project(path:':libs:utils:WordPressUtils', configuration: 'debug') 
    releaseCompile project(path:':libs:networking:WordPressNetworking', configuration: 'release') 
    debugCompile project(path:':libs:networking:WordPressNetworking', configuration: 'debug') 
    releaseCompile project(path:':libs:analytics:WordPressAnalytics', configuration: 'release') 
    debugCompile project(path:':libs:analytics:WordPressAnalytics', configuration: 'debug') 
    releaseCompile project(path:':libs:editor:WordPressEditor', configuration: 'release') 
    debugCompile project(path:':libs:editor:WordPressEditor', configuration: 'debug') 
} 

configurations.all { 
    // Exclude packaged wordpress sub projects, force the use of the source project 
    // (eg. use :libs:utils:WordPressUtils instead of 'org.wordpress:utils') 
    exclude group: 'org.wordpress', module: 'utils' 
    exclude group: 'org.wordpress', module: 'analytics' 
} 

task generateCrashlyticsConfig(group: "generate", description: "Generate Crashlytics config") { 
    def outputFile = new File("${rootDir}/WordPress/crashlytics.properties") 
    def inputFile = file("${rootDir}/WordPress/gradle.properties") 
    if (!inputFile.exists()) { 
     throw new StopActionException("Build configuration file:" + inputFile 
       + " doesn't exist, follow README instructions") 
    } 

    outputs.file outputFile 
    inputs.file inputFile 
    doLast { 
     def properties = new Properties() 
     inputFile.withInputStream { stream -> 
      properties.load(stream) 
     } 
     def crashlyticsApiKey = properties.getProperty('crashlytics.apikey', '0') 
     def writer = new FileWriter(outputFile) 
     writer.write("""// auto-generated file from ${rootDir}/gradle.properties do not modify 
apiKey=${crashlyticsApiKey}""") 
     writer.close() 
    } 
} 

// Add generateCrashlyticsConfig to all generateBuildConfig tasks (all variants) 
android.applicationVariants.all { variant -> 
    variant.generateBuildConfig.dependsOn(generateCrashlyticsConfig) 
} 

// Add properties named "wp.xxx" to our BuildConfig 
android.buildTypes.all { buildType -> 
    project.properties.any { property -> 
     if (property.key.toLowerCase().startsWith("wp.")) { 
      buildType.buildConfigField "String", property.key.replace("wp.", "").replace(".", "_").toUpperCase(), 
        "\"${property.value}\"" 
     } 
    } 
} 

// For app signing 
if (["storeFile", "storePassword", "keyAlias", "keyPassword"].count { !project.hasProperty(it) } == 0) { 
    android { 
     signingConfigs { 
      release { 
       storeFile = file(project.storeFile) 
       storePassword = project.storePassword 
       keyAlias = project.keyAlias 
       keyPassword = project.keyPassword 
      } 
     } 
    } 
    android.buildTypes.release.signingConfig = android.signingConfigs.release 
} 
+1

提到发表您的'build.gradle'请 –

+0

的http://计算器。 com/questions/28113179/twitter-fabric-failure-to-install-in-android-studio-due-to-missing-dependencies –

+0

@intelliJ Amiya我有帖子build.gradle。 – colombo

回答

0

迈克Crashlytics和面料在这里。

看起来您的build.gradle引用了错误的Fabric回购。你想用:

buildscript { 
    repositories { 
     jcenter() 
     maven { url 'https://maven.fabric.io/public' 
    } 
} 

dependencies { 
     classpath 'com.android.tools.build:gradle:1.5.0'  
     classpath 'io.fabric.tools:gradle:1.+' 
} 

apply plugin: 'com.android.application' 
apply plugin: 'io.fabric' 

repositories { 
    jcenter() 
    maven { url 'https://maven.fabric.io/public' } 
} 

maven { url 'https://maven.fabric.io/repo' } 

截至the documentation.